mirror of
https://github.com/ansible/awx.git
synced 2026-05-12 20:07:37 -02:30
update to wait
This commit is contained in:
@@ -132,23 +132,16 @@ def main():
|
|||||||
# 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()
|
||||||
|
|
||||||
project_url = result['json']['url']
|
if not wait:
|
||||||
while not result['json']['finished']:
|
module.exit_json(**module.json_output)
|
||||||
# If we are past our time out fail with a message
|
|
||||||
if timeout and timeout < time.time() - start:
|
|
||||||
module.json_output['msg'] = "Monitoring aborted due to timeout"
|
|
||||||
module.fail_json(**module.json_output)
|
|
||||||
|
|
||||||
# Put the process to sleep for our interval
|
# Invoke wait function
|
||||||
time.sleep(interval)
|
module.wait_on_url(
|
||||||
|
url=result['json']['url'],
|
||||||
result = module.get_endpoint(project_url)
|
object_name=name,
|
||||||
module.json_output['status'] = result['json']['status']
|
object_type='Project Update',
|
||||||
|
timeout=timeout, interval=interval
|
||||||
# If the update has failed, we want to raise a task failure for that so we get a non-zero response.
|
)
|
||||||
if result['json']['failed']:
|
|
||||||
module.json_output['msg'] = 'The project "{0}" failed'.format(name)
|
|
||||||
module.fail_json(**module.json_output)
|
|
||||||
|
|
||||||
module.exit_json(**module.json_output)
|
module.exit_json(**module.json_output)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user