Fix 'task name is not templated in retry callback' (add task_name property to TaskResult) (#21214)

Fix 'task name is not templated in retry callback'

Add a task_name property to TaskResult that knows to
check in TaskResult._task_fields.

Add integration test for v2_retry_runner callback

Fixes #18236
This commit is contained in:
Adrian Likins 2017-02-24 12:33:24 -05:00 committed by GitHub
parent 78c4f03e50
commit 8830cde28d
6 changed files with 56 additions and 2 deletions

View file

@ -301,7 +301,8 @@ class CallbackModule(CallbackBase):
self._display.vvvv('%s: %s' % (option,val))
def v2_runner_retry(self, result):
msg = "FAILED - RETRYING: %s (%d retries left)." % (result._task, result._result['retries'] - result._result['attempts'])
task_name = result.task_name or result._task
msg = "FAILED - RETRYING: %s (%d retries left)." % (task_name, result._result['retries'] - result._result['attempts'])
if (self._display.verbosity > 2 or '_ansible_verbose_always' in result._result) and not '_ansible_verbose_override' in result._result:
msg += "Result was: %s" % self._dump_results(result._result)
self._display.display(msg, color=C.COLOR_DEBUG)