diff options
author | nitzmahone <mdavis@ansible.com> | 2015-11-12 16:19:52 -0800 |
---|---|---|
committer | nitzmahone <mdavis@ansible.com> | 2016-03-09 14:53:24 -0800 |
commit | 816bd42b07f222726cdf1a146ceb028e0a3f358d (patch) | |
tree | 176d79463fdc18672b6d020ffee8ee344f476886 | |
parent | e83db3634e2ac42e8d6a8d86de6c9f1285dab615 (diff) | |
download | ansible-modules-core-816bd42b07f222726cdf1a146ceb028e0a3f358d.tar.gz |
mark failed async_status as finished
Running async_status in an "until: result.finished" loop will mask a module failure (eg, traceback) with a
template failure, because the fail dict doesn't include "finished" (eg, you'll see "ERROR! The conditional check 'bogus_out.finished' failed. The error was: ERROR! error while evaluating conditional: bogus_out.finished ({% if bogus_out.finished %} True {% else %} False {% endif %}"). Because the failure dict still includes "failed: true",
this change has no effect on stoppage/failure reporting, it just prevents the common usage pattern from masking the underlying error message.
-rw-r--r-- | utilities/logic/async_status.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/utilities/logic/async_status.py b/utilities/logic/async_status.py index 8b134c94..b4c74976 100644 --- a/utilities/logic/async_status.py +++ b/utilities/logic/async_status.py @@ -66,7 +66,7 @@ def main(): log_path = os.path.join(logdir, jid) if not os.path.exists(log_path): - module.fail_json(msg="could not find job", ansible_job_id=jid) + module.fail_json(msg="could not find job", ansible_job_id=jid, started=1, finished=1) if mode == 'cleanup': os.unlink(log_path) @@ -85,7 +85,7 @@ def main(): module.exit_json(results_file=log_path, ansible_job_id=jid, started=1, finished=0) else: module.fail_json(ansible_job_id=jid, results_file=log_path, - msg="Could not parse job output: %s" % data) + msg="Could not parse job output: %s" % data, started=1, finished=1) if not 'started' in data: data['finished'] = 1 |