mirror of
https://github.com/ansible/awx.git
synced 2026-03-06 19:21:06 -03:30
updated to error if finished not in result
This commit is contained in:
@@ -594,17 +594,21 @@ class TowerAPIModule(TowerModule):
|
|||||||
# 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)
|
||||||
while not result['json']['finished']:
|
if result['json']['finished'] is None:
|
||||||
# If we are past our time out fail with a message
|
self.json_output['msg'] = 'Monitoring of {0} "{1}" aborted due to timeout'.format(object_type, object_name)
|
||||||
if timeout and timeout < time.time() - start:
|
self.fail_json(**self.json_output)
|
||||||
self.json_output['msg'] = 'Monitoring of {0} "{1}" aborted due to timeout'.format(object_type, object_name)
|
else:
|
||||||
self.fail_json(**self.json_output)
|
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)
|
||||||
|
self.fail_json(**self.json_output)
|
||||||
|
|
||||||
# Put the process to sleep for our interval
|
# Put the process to sleep for our interval
|
||||||
time.sleep(interval)
|
time.sleep(interval)
|
||||||
|
|
||||||
result = self.get_endpoint(url)
|
result = self.get_endpoint(url)
|
||||||
self.json_output['status'] = result['json']['status']
|
self.json_output['status'] = result['json']['status']
|
||||||
|
|
||||||
# If the job has failed, we want to raise a task failure for that so we get a non-zero response.
|
# 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']:
|
if result['json']['failed']:
|
||||||
|
|||||||
Reference in New Issue
Block a user