mirror of
https://github.com/ansible/awx.git
synced 2026-03-23 11:55:04 -02:30
Merge branch 'survey_logic' of github.com:sean-m-sullivan/awx into survey_logic
This commit is contained in:
@@ -94,10 +94,12 @@ options:
|
|||||||
- Setting that variable will prompt the user for job type on the
|
- Setting that variable will prompt the user for job type on the
|
||||||
workflow launch.
|
workflow launch.
|
||||||
type: bool
|
type: bool
|
||||||
survey:
|
survey_spec:
|
||||||
description:
|
description:
|
||||||
- The definition of the survey associated to the workflow.
|
- The definition of the survey associated to the workflow.
|
||||||
type: dict
|
type: dict
|
||||||
|
aliases:
|
||||||
|
- survey
|
||||||
labels:
|
labels:
|
||||||
description:
|
description:
|
||||||
- The labels applied to this job template
|
- The labels applied to this job template
|
||||||
@@ -149,7 +151,7 @@ import json
|
|||||||
|
|
||||||
def update_survey(module, last_request):
|
def update_survey(module, last_request):
|
||||||
spec_endpoint = last_request.get('related', {}).get('survey_spec')
|
spec_endpoint = last_request.get('related', {}).get('survey_spec')
|
||||||
module.post_endpoint(spec_endpoint, **{'data': module.params.get('survey')})
|
module.post_endpoint(spec_endpoint, **{'data': module.params.get('survey_spec')})
|
||||||
module.exit_json(**module.json_output)
|
module.exit_json(**module.json_output)
|
||||||
|
|
||||||
|
|
||||||
@@ -161,7 +163,7 @@ def main():
|
|||||||
description=dict(),
|
description=dict(),
|
||||||
extra_vars=dict(type='dict'),
|
extra_vars=dict(type='dict'),
|
||||||
organization=dict(),
|
organization=dict(),
|
||||||
survey=dict(type='dict'), # special handling
|
survey_spec=dict(type='dict', aliases=['survey']),
|
||||||
survey_enabled=dict(type='bool'),
|
survey_enabled=dict(type='bool'),
|
||||||
allow_simultaneous=dict(type='bool'),
|
allow_simultaneous=dict(type='bool'),
|
||||||
ask_variables_on_launch=dict(type='bool'),
|
ask_variables_on_launch=dict(type='bool'),
|
||||||
@@ -266,7 +268,7 @@ def main():
|
|||||||
# association_fields['labels'].append(label_id)
|
# association_fields['labels'].append(label_id)
|
||||||
|
|
||||||
on_change = None
|
on_change = None
|
||||||
new_spec = module.params.get('survey')
|
new_spec = module.params.get('survey_spec')
|
||||||
if new_spec:
|
if new_spec:
|
||||||
existing_spec = None
|
existing_spec = None
|
||||||
if existing_item:
|
if existing_item:
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ no_api_parameter_ok = {
|
|||||||
# Organization is how we are looking up job templates, Approval node is for workflow_approval_templates
|
# Organization is how we are looking up job templates, Approval node is for workflow_approval_templates
|
||||||
'tower_workflow_job_template_node': ['organization', 'approval_node'],
|
'tower_workflow_job_template_node': ['organization', 'approval_node'],
|
||||||
# Survey is how we handle associations
|
# Survey is how we handle associations
|
||||||
'tower_workflow_job_template': ['survey'],
|
'tower_workflow_job_template': ['survey_spec'],
|
||||||
# ad hoc commands support interval and timeout since its more like tower_job_launc
|
# ad hoc commands support interval and timeout since its more like tower_job_launc
|
||||||
'tower_ad_hoc_command': ['interval', 'timeout', 'wait'],
|
'tower_ad_hoc_command': ['interval', 'timeout', 'wait'],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ def test_create_workflow_job_template(run_module, admin_user, organization, surv
|
|||||||
'name': 'foo-workflow',
|
'name': 'foo-workflow',
|
||||||
'organization': organization.name,
|
'organization': organization.name,
|
||||||
'extra_vars': {'foo': 'bar', 'another-foo': {'barz': 'bar2'}},
|
'extra_vars': {'foo': 'bar', 'another-foo': {'barz': 'bar2'}},
|
||||||
'survey': survey_spec,
|
'survey_spec': survey_spec,
|
||||||
'survey_enabled': True,
|
'survey_enabled': True,
|
||||||
'state': 'present'
|
'state': 'present'
|
||||||
}, admin_user)
|
}, admin_user)
|
||||||
@@ -72,7 +72,7 @@ def test_survey_spec_only_changed(run_module, admin_user, organization, survey_s
|
|||||||
result = run_module('tower_workflow_job_template', {
|
result = run_module('tower_workflow_job_template', {
|
||||||
'name': 'foo-workflow',
|
'name': 'foo-workflow',
|
||||||
'organization': organization.name,
|
'organization': organization.name,
|
||||||
'survey': survey_spec,
|
'survey_spec': survey_spec,
|
||||||
'state': 'present'
|
'state': 'present'
|
||||||
}, admin_user)
|
}, admin_user)
|
||||||
assert not result.get('failed', False), result.get('msg', result)
|
assert not result.get('failed', False), result.get('msg', result)
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Run Integration Test
|
|
||||||
hosts: localhost
|
|
||||||
connection: local
|
|
||||||
gather_facts: False
|
|
||||||
environment:
|
|
||||||
TOWER_HOST: https://ansible-tower-web-svc-tower.apps-crc.testing
|
|
||||||
TOWER_USERNAME: admin
|
|
||||||
TOWER_PASSWORD: password
|
|
||||||
TOWER_VERIFY_SSL: False
|
|
||||||
collections:
|
|
||||||
- awx.awx
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- include_tasks: main.yml
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Run Integration Test
|
|
||||||
hosts: localhost
|
|
||||||
connection: local
|
|
||||||
gather_facts: False
|
|
||||||
environment:
|
|
||||||
TOWER_HOST: https://ansible-tower-web-svc-tower.apps-crc.testing
|
|
||||||
TOWER_USERNAME: admin
|
|
||||||
TOWER_PASSWORD: password
|
|
||||||
TOWER_VERIFY_SSL: False
|
|
||||||
collections:
|
|
||||||
- awx.awx
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- include_tasks: main.yml
|
|
||||||
Reference in New Issue
Block a user