From 328435d4359ff082531bcb6658aff1841f3a80e9 Mon Sep 17 00:00:00 2001 From: sean-m-sullivan Date: Thu, 14 Jan 2021 15:37:59 -0600 Subject: [PATCH 1/3] update to survey option on workflow module. --- .../plugins/modules/tower_workflow_job_template.py | 10 ++++++---- awx_collection/test/awx/test_workflow_job_template.py | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/awx_collection/plugins/modules/tower_workflow_job_template.py b/awx_collection/plugins/modules/tower_workflow_job_template.py index 73435894b2..6bfa8fafe4 100644 --- a/awx_collection/plugins/modules/tower_workflow_job_template.py +++ b/awx_collection/plugins/modules/tower_workflow_job_template.py @@ -94,10 +94,12 @@ options: - Setting that variable will prompt the user for job type on the workflow launch. type: bool - survey: + survey_spec: description: - The definition of the survey associated to the workflow. type: dict + aliases: + - survey labels: description: - The labels applied to this job template @@ -149,7 +151,7 @@ import json def update_survey(module, last_request): 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) @@ -161,7 +163,7 @@ def main(): description=dict(), extra_vars=dict(type='dict'), organization=dict(), - survey=dict(type='dict'), # special handling + survey_spec=dict(type='dict'), # special handling survey_enabled=dict(type='bool'), allow_simultaneous=dict(type='bool'), ask_variables_on_launch=dict(type='bool'), @@ -266,7 +268,7 @@ def main(): # association_fields['labels'].append(label_id) on_change = None - new_spec = module.params.get('survey') + new_spec = module.params.get('survey_spec') if new_spec: existing_spec = None if existing_item: diff --git a/awx_collection/test/awx/test_workflow_job_template.py b/awx_collection/test/awx/test_workflow_job_template.py index bc2a44b11e..a125b01249 100644 --- a/awx_collection/test/awx/test_workflow_job_template.py +++ b/awx_collection/test/awx/test_workflow_job_template.py @@ -12,7 +12,7 @@ def test_create_workflow_job_template(run_module, admin_user, organization, surv 'name': 'foo-workflow', 'organization': organization.name, 'extra_vars': {'foo': 'bar', 'another-foo': {'barz': 'bar2'}}, - 'survey': survey_spec, + 'survey_spec': survey_spec, 'survey_enabled': True, 'state': 'present' }, 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', { 'name': 'foo-workflow', 'organization': organization.name, - 'survey': survey_spec, + 'survey_spec': survey_spec, 'state': 'present' }, admin_user) assert not result.get('failed', False), result.get('msg', result) From 73c46030bc7ce42cfc0051c0c4dfc5f5a526fefd Mon Sep 17 00:00:00 2001 From: sean-m-sullivan Date: Thu, 14 Jan 2021 16:19:39 -0600 Subject: [PATCH 2/3] update completeness --- awx_collection/test/awx/test_completeness.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx_collection/test/awx/test_completeness.py b/awx_collection/test/awx/test_completeness.py index 08bbd8b0ad..922cc785bc 100644 --- a/awx_collection/test/awx/test_completeness.py +++ b/awx_collection/test/awx/test_completeness.py @@ -47,7 +47,7 @@ no_api_parameter_ok = { # Organization is how we are looking up job templates, Approval node is for workflow_approval_templates 'tower_workflow_job_template_node': ['organization', 'approval_node'], # 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 'tower_ad_hoc_command': ['interval', 'timeout', 'wait'], } From 74d1859552ac5bdd8df8a4f45b156fc7873b240d Mon Sep 17 00:00:00 2001 From: sean-m-sullivan Date: Mon, 18 Jan 2021 09:12:30 -0600 Subject: [PATCH 3/3] add alias --- awx_collection/plugins/modules/tower_workflow_job_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx_collection/plugins/modules/tower_workflow_job_template.py b/awx_collection/plugins/modules/tower_workflow_job_template.py index 6bfa8fafe4..f6d972e76f 100644 --- a/awx_collection/plugins/modules/tower_workflow_job_template.py +++ b/awx_collection/plugins/modules/tower_workflow_job_template.py @@ -163,7 +163,7 @@ def main(): description=dict(), extra_vars=dict(type='dict'), organization=dict(), - survey_spec=dict(type='dict'), # special handling + survey_spec=dict(type='dict', aliases=['survey']), survey_enabled=dict(type='bool'), allow_simultaneous=dict(type='bool'), ask_variables_on_launch=dict(type='bool'),