mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 01:17:37 -02:30
updated parameters and errors
This commit is contained in:
@@ -590,7 +590,7 @@ class TowerAPIModule(TowerModule):
|
|||||||
else:
|
else:
|
||||||
return True
|
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
|
# Grab our start time to compare against for the timeout
|
||||||
start = time.time()
|
start = time.time()
|
||||||
result = self.get_endpoint(url)
|
result = self.get_endpoint(url)
|
||||||
|
|||||||
@@ -247,9 +247,9 @@ def main():
|
|||||||
|
|
||||||
# Invoke wait function
|
# Invoke wait function
|
||||||
results = module.wait_on_url(
|
results = module.wait_on_url(
|
||||||
|
url=results['json']['url'],
|
||||||
object_name=name,
|
object_name=name,
|
||||||
object_type='job',
|
object_type='job',
|
||||||
url=results['json']['url'],
|
|
||||||
timeout=timeout, interval=interval
|
timeout=timeout, interval=interval
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -141,14 +141,17 @@ def main():
|
|||||||
|
|
||||||
# Invoke wait function
|
# Invoke wait function
|
||||||
result = module.wait_on_url(
|
result = module.wait_on_url(
|
||||||
|
url=job['url'],
|
||||||
object_name=job_id,
|
object_name=job_id,
|
||||||
object_type='job',
|
object_type='job',
|
||||||
url=job['url'],
|
|
||||||
timeout=timeout, interval=interval
|
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__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -179,9 +179,9 @@ def main():
|
|||||||
|
|
||||||
# Invoke wait function
|
# Invoke wait function
|
||||||
module.wait_on_url(
|
module.wait_on_url(
|
||||||
|
url=result['json']['url'],
|
||||||
object_name=name,
|
object_name=name,
|
||||||
object_type='workflow_job',
|
object_type='workflow_job',
|
||||||
url=result['json']['url'],
|
|
||||||
timeout=timeout, interval=interval
|
timeout=timeout, interval=interval
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user