summaryrefslogtreecommitdiffstats
path: root/awx_collection
diff options
context:
space:
mode:
authorsean-m-sullivan <ssulliva@redhat.com>2020-10-19 22:11:19 +0200
committersean-m-sullivan <ssulliva@redhat.com>2020-10-19 22:11:19 +0200
commit91ef686fe05daf436616390d7dba321529b8ec01 (patch)
treedf547c75191e20e7f8df0c406c6880c28392cbbc /awx_collection
parentlinting (diff)
downloadawx-91ef686fe05daf436616390d7dba321529b8ec01.tar.xz
awx-91ef686fe05daf436616390d7dba321529b8ec01.zip
update to incorporate requested changes, change approve to 201 response.
Diffstat (limited to 'awx_collection')
-rw-r--r--awx_collection/plugins/module_utils/tower_api.py12
-rw-r--r--awx_collection/plugins/modules/tower_workflow_job_template_node.py2
2 files changed, 3 insertions, 11 deletions
diff --git a/awx_collection/plugins/module_utils/tower_api.py b/awx_collection/plugins/module_utils/tower_api.py
index 643fbd05fc..5c0da5a8cb 100644
--- a/awx_collection/plugins/module_utils/tower_api.py
+++ b/awx_collection/plugins/module_utils/tower_api.py
@@ -382,7 +382,7 @@ class TowerAPIModule(TowerModule):
if auto_exit:
self.exit_json(**self.json_output)
else:
- return None
+ return self.json_output
def modify_associations(self, association_endpoint, new_association_list):
# if we got None instead of [] we are not modifying the association_list
@@ -438,16 +438,8 @@ class TowerAPIModule(TowerModule):
response = self.post_endpoint(endpoint, **{'data': new_item})
- if response['status_code'] == 201:
- self.json_output['name'] = 'unknown'
- for key in ('name', 'username', 'identifier', 'hostname'):
- if key in response['json']:
- self.json_output['name'] = response['json'][key]
- self.json_output['id'] = response['json']['id']
- self.json_output['changed'] = True
- item_url = response['json']['url']
# 200 is response from approval node creation
- elif response['status_code'] == 200 and item_type == 'workflow_job_template_approval_node':
+ if response['status_code'] == 201:
self.json_output['name'] = 'unknown'
for key in ('name', 'username', 'identifier', 'hostname'):
if key in response['json']:
diff --git a/awx_collection/plugins/modules/tower_workflow_job_template_node.py b/awx_collection/plugins/modules/tower_workflow_job_template_node.py
index 1718af91e8..5fb6b03e53 100644
--- a/awx_collection/plugins/modules/tower_workflow_job_template_node.py
+++ b/awx_collection/plugins/modules/tower_workflow_job_template_node.py
@@ -319,7 +319,7 @@ def main():
# Due to not able to lookup workflow_approval_templates, find the existing item in another place
if workflow_job_template_node['related'].get('unified_job_template') is not None:
existing_item = module.get_endpoint(workflow_job_template_node['related']['unified_job_template'])['json']
- approval_endpoint = 'workflow_job_template_nodes/' + str(workflow_job_template_node_id) + '/create_approval_template/'
+ approval_endpoint = 'workflow_job_template_nodes/{0}/create_approval_template/'.format(workflow_job_template_node_id)
module.create_or_update_if_needed(
existing_item, new_fields,
endpoint=approval_endpoint, item_type='workflow_job_template_approval_node',