In tower_job_wait intentionally fail module for failure

This commit is contained in:
AlanCoding
2019-10-31 12:12:43 -04:00
parent b878aed400
commit 35a565d09f
2 changed files with 59 additions and 0 deletions

View File

@@ -141,6 +141,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)