From 0bc927820bc57e6862ce7befed995d4e7df69e80 Mon Sep 17 00:00:00 2001 From: sean-m-sullivan Date: Mon, 31 Aug 2020 15:24:32 -0500 Subject: [PATCH] updated legacy messages --- awx_collection/plugins/module_utils/tower_api.py | 12 ++++++++++-- awx_collection/plugins/modules/tower_job_launch.py | 2 +- awx_collection/plugins/modules/tower_job_wait.py | 2 +- .../plugins/modules/tower_workflow_launch.py | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/awx_collection/plugins/module_utils/tower_api.py b/awx_collection/plugins/module_utils/tower_api.py index 8b619dd36e..3e3f668401 100644 --- a/awx_collection/plugins/module_utils/tower_api.py +++ b/awx_collection/plugins/module_utils/tower_api.py @@ -597,7 +597,11 @@ class TowerAPIModule(TowerModule): while not result['json']['finished']: # If we are past our time out fail with a message if timeout and timeout < time.time() - start: - self.json_output['msg'] = 'Monitoring of {0} "{1}" aborted due to timeout'.format(object_type, object_name) + # Account for Legacy messages + if object_type is 'legacy_job_wait': + self.json_output['msg'] = 'Monitoring of Job - {1} aborted due to timeout'.format(object_name) + else: + self.json_output['msg'] = 'Monitoring of {0} - {1} aborted due to timeout'.format(object_type, object_name) self.wait_output(result) self.fail_json(**self.json_output) @@ -609,7 +613,11 @@ class TowerAPIModule(TowerModule): # If the job has failed, we want to raise a task failure for that so we get a non-zero response. if result['json']['failed']: - self.json_output['msg'] = 'The {0} "{1}" failed'.format(object_type, object_name) + # Account for Legacy messages + if object_type is 'legacy_job_wait': + self.json_output['msg'] = 'Job with id {0} failed'.format(object_name) + else: + self.json_output['msg'] = 'The {0} - {1}, failed'.format(object_type, object_name) self.wait_output(result) self.fail_json(**self.json_output) diff --git a/awx_collection/plugins/modules/tower_job_launch.py b/awx_collection/plugins/modules/tower_job_launch.py index 8345b55b66..11ebb14110 100644 --- a/awx_collection/plugins/modules/tower_job_launch.py +++ b/awx_collection/plugins/modules/tower_job_launch.py @@ -249,7 +249,7 @@ def main(): results = module.wait_on_url( url=results['json']['url'], object_name=name, - object_type='job', + object_type='Job', timeout=timeout, interval=interval ) diff --git a/awx_collection/plugins/modules/tower_job_wait.py b/awx_collection/plugins/modules/tower_job_wait.py index 1c65e141dc..46bb80d007 100644 --- a/awx_collection/plugins/modules/tower_job_wait.py +++ b/awx_collection/plugins/modules/tower_job_wait.py @@ -143,7 +143,7 @@ def main(): result = module.wait_on_url( url=job['url'], object_name=job_id, - object_type='job', + object_type='legacy_job_wait', timeout=timeout, interval=interval ) diff --git a/awx_collection/plugins/modules/tower_workflow_launch.py b/awx_collection/plugins/modules/tower_workflow_launch.py index b665adbf15..8267e9352c 100644 --- a/awx_collection/plugins/modules/tower_workflow_launch.py +++ b/awx_collection/plugins/modules/tower_workflow_launch.py @@ -181,7 +181,7 @@ def main(): module.wait_on_url( url=result['json']['url'], object_name=name, - object_type='workflow_job', + object_type='Workflow Job', timeout=timeout, interval=interval )