mirror of
https://github.com/ansible/awx.git
synced 2026-02-04 19:18:13 -03:30
Merge pull request #5195 from AlanCoding/job_fail_json
In tower_job_wait intentionally fail module for failure Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -136,6 +136,12 @@ def main():
|
||||
json_output['timeout'] = True
|
||||
except exc.NotFound as excinfo:
|
||||
fail_json = dict(msg='Unable to wait, no job_id {0} found: {1}'.format(job_id, excinfo), changed=False)
|
||||
except exc.JobFailure as excinfo:
|
||||
fail_json = dict(msg='Job with id={} failed, error: {}'.format(job_id, excinfo))
|
||||
fail_json['success'] = False
|
||||
result = job.get(job_id)
|
||||
for k in ('id', 'status', 'elapsed', 'started', 'finished'):
|
||||
fail_json[k] = result.get(k)
|
||||
except (exc.ConnectionError, exc.BadRequest, exc.AuthError) as excinfo:
|
||||
fail_json = dict(msg='Unable to wait for job: {0}'.format(excinfo), changed=False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user