diff --git a/awx_collection/plugins/module_utils/tower_api.py b/awx_collection/plugins/module_utils/tower_api.py index 138f523515..dfab8ad9ab 100644 --- a/awx_collection/plugins/module_utils/tower_api.py +++ b/awx_collection/plugins/module_utils/tower_api.py @@ -590,7 +590,7 @@ class TowerAPIModule(TowerModule): else: return True - def wait_on_url(self, object_name=None, object_type=None, url=None, timeout=None, interval=None): + def wait_on_url(self, url, object_name, object_type, timeout=30, interval=10): # Grab our start time to compare against for the timeout start = time.time() result = self.get_endpoint(url) diff --git a/awx_collection/plugins/modules/tower_job_launch.py b/awx_collection/plugins/modules/tower_job_launch.py index a016d1d30b..8345b55b66 100644 --- a/awx_collection/plugins/modules/tower_job_launch.py +++ b/awx_collection/plugins/modules/tower_job_launch.py @@ -247,9 +247,9 @@ def main(): # Invoke wait function results = module.wait_on_url( + url=results['json']['url'], object_name=name, object_type='job', - url=results['json']['url'], 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 edb9b718dc..888cce8381 100644 --- a/awx_collection/plugins/modules/tower_job_wait.py +++ b/awx_collection/plugins/modules/tower_job_wait.py @@ -141,14 +141,17 @@ def main(): # Invoke wait function result = module.wait_on_url( + url=job['url'], object_name=job_id, object_type='job', - url=job['url'], timeout=timeout, interval=interval ) - module.exit_json(**module.json_output) + # Format data to keep legacy compatability. + for k in ('id', 'status', 'elapsed', 'started', 'finished'): + module.json_output[k] = result['json'].get(k) + module.exit_json(**module.json_output) if __name__ == '__main__': main() diff --git a/awx_collection/plugins/modules/tower_workflow_launch.py b/awx_collection/plugins/modules/tower_workflow_launch.py index 70377fd207..b665adbf15 100644 --- a/awx_collection/plugins/modules/tower_workflow_launch.py +++ b/awx_collection/plugins/modules/tower_workflow_launch.py @@ -179,9 +179,9 @@ def main(): # Invoke wait function module.wait_on_url( + url=result['json']['url'], object_name=name, object_type='workflow_job', - url=result['json']['url'], timeout=timeout, interval=interval )