mirror of
https://github.com/ansible/awx.git
synced 2026-08-08 05:41:45 -02:30
import awxkit
Co-authored-by: Christopher Wang <cwang@ansible.com> Co-authored-by: Jake McDermott <jmcdermott@ansible.com> Co-authored-by: Jim Ladd <jladd@redhat.com> Co-authored-by: Elijah DeLee <kdelee@redhat.com> Co-authored-by: Alan Rominger <arominge@redhat.com> Co-authored-by: Yanis Guenane <yanis@guenane.org>
This commit is contained in:
15
awxkit/awxkit/api/mixins/has_survey.py
Normal file
15
awxkit/awxkit/api/mixins/has_survey.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from awxkit.utils import random_title
|
||||
|
||||
|
||||
class HasSurvey(object):
|
||||
def add_survey(self, spec=None, name=None, description=None, required=False, enabled=True):
|
||||
payload = dict(name=name or 'Survey - {}'.format(random_title()),
|
||||
description=description or random_title(10),
|
||||
spec=spec or [dict(required=required,
|
||||
question_name="What's the password?",
|
||||
variable="secret",
|
||||
type="password",
|
||||
default="foo")])
|
||||
if enabled != self.survey_enabled:
|
||||
self.patch(survey_enabled=enabled)
|
||||
return self.related.survey_spec.post(payload).get()
|
||||
Reference in New Issue
Block a user