Do not remove exception from result, hide output.

This allows all callback plugins access to exception details.
pull/16074/head
Matt Clay 9 years ago
parent 4c3c294a03
commit 126bc40ecf

@ -103,6 +103,10 @@ class CallbackBase:
if self._display.verbosity < 3 and 'diff' in result: if self._display.verbosity < 3 and 'diff' in result:
del abridged_result['diff'] del abridged_result['diff']
# remove exception from screen output
if 'exception' in abridged_result:
del abridged_result['exception']
return json.dumps(abridged_result, indent=indent, ensure_ascii=False, sort_keys=sort_keys) return json.dumps(abridged_result, indent=indent, ensure_ascii=False, sort_keys=sort_keys)
def _handle_warnings(self, res): def _handle_warnings(self, res):

@ -46,9 +46,6 @@ class CallbackModule(CallbackBase):
self._display.display(msg, color=C.COLOR_ERROR) self._display.display(msg, color=C.COLOR_ERROR)
# finally, remove the exception from the result so it's not shown every time
del result._result['exception']
if result._task.loop and 'results' in result._result: if result._task.loop and 'results' in result._result:
self._process_items(result) self._process_items(result)
@ -193,9 +190,6 @@ class CallbackModule(CallbackBase):
self._display.display(msg, color=C.COLOR_ERROR) self._display.display(msg, color=C.COLOR_ERROR)
# finally, remove the exception from the result so it's not shown every time
del result._result['exception']
msg = "failed: " msg = "failed: "
if delegated_vars: if delegated_vars:
msg += "[%s -> %s]" % (result._host.get_name(), delegated_vars['ansible_host']) msg += "[%s -> %s]" % (result._host.get_name(), delegated_vars['ansible_host'])

@ -55,9 +55,6 @@ class CallbackModule(CallbackBase):
self._display.display(msg, color=C.COLOR_ERROR) self._display.display(msg, color=C.COLOR_ERROR)
# finally, remove the exception from the result so it's not shown every time
del result._result['exception']
if result._task.action in C.MODULE_NO_JSON: if result._task.action in C.MODULE_NO_JSON:
self._display.display(self._command_generic_msg(result._host.get_name(), result._result, "FAILED"), color=C.COLOR_ERROR) self._display.display(self._command_generic_msg(result._host.get_name(), result._result, "FAILED"), color=C.COLOR_ERROR)
else: else:

@ -56,9 +56,6 @@ class CallbackModule(CallbackBase):
else: else:
self._display.display(msg, color=C.COLOR_ERROR) self._display.display(msg, color=C.COLOR_ERROR)
# finally, remove the exception from the result so it's not shown every time
del result._result['exception']
self._display.display("%s | FAILED! => %s" % (result._host.get_name(), self._dump_results(result._result, indent=0).replace('\n','')), color=C.COLOR_ERROR) self._display.display("%s | FAILED! => %s" % (result._host.get_name(), self._dump_results(result._result, indent=0).replace('\n','')), color=C.COLOR_ERROR)
def v2_runner_on_ok(self, result): def v2_runner_on_ok(self, result):

Loading…
Cancel
Save