properly filter out noise from debug
This commit is contained in:
parent
58dc6c7882
commit
5ffb40fcdb
2 changed files with 15 additions and 7 deletions
|
@ -209,7 +209,7 @@ class CallbackBase:
|
||||||
|
|
||||||
def _clean_results(self, result, task_name):
|
def _clean_results(self, result, task_name):
|
||||||
if task_name in ['debug']:
|
if task_name in ['debug']:
|
||||||
for remove_key in ('changed', 'invocation', 'failed'):
|
for remove_key in ('changed', 'invocation', 'failed', 'skipped'):
|
||||||
if remove_key in result:
|
if remove_key in result:
|
||||||
del result[remove_key]
|
del result[remove_key]
|
||||||
|
|
||||||
|
|
|
@ -51,10 +51,12 @@ class CallbackModule(CallbackBase):
|
||||||
|
|
||||||
def v2_runner_on_failed(self, result, ignore_errors=False):
|
def v2_runner_on_failed(self, result, ignore_errors=False):
|
||||||
|
|
||||||
|
delegated_vars = result._result.get('_ansible_delegated_vars', None)
|
||||||
|
self._clean_results(result._result, result._task.action)
|
||||||
|
|
||||||
if self._play.strategy == 'free' and self._last_task_banner != result._task._uuid:
|
if self._play.strategy == 'free' and self._last_task_banner != result._task._uuid:
|
||||||
self._print_task_banner(result._task)
|
self._print_task_banner(result._task)
|
||||||
|
|
||||||
delegated_vars = result._result.get('_ansible_delegated_vars', None)
|
|
||||||
self._handle_exception(result._result)
|
self._handle_exception(result._result)
|
||||||
self._handle_warnings(result._result)
|
self._handle_warnings(result._result)
|
||||||
|
|
||||||
|
@ -64,8 +66,7 @@ class CallbackModule(CallbackBase):
|
||||||
else:
|
else:
|
||||||
if delegated_vars:
|
if delegated_vars:
|
||||||
self._display.display("fatal: [%s -> %s]: FAILED! => %s" % (result._host.get_name(), delegated_vars['ansible_host'],
|
self._display.display("fatal: [%s -> %s]: FAILED! => %s" % (result._host.get_name(), delegated_vars['ansible_host'],
|
||||||
self._dump_results(result._result)),
|
self._dump_results(result._result)), color=C.COLOR_ERROR)
|
||||||
color=C.COLOR_ERROR)
|
|
||||||
else:
|
else:
|
||||||
self._display.display("fatal: [%s]: FAILED! => %s" % (result._host.get_name(), self._dump_results(result._result)), color=C.COLOR_ERROR)
|
self._display.display("fatal: [%s]: FAILED! => %s" % (result._host.get_name(), self._dump_results(result._result)), color=C.COLOR_ERROR)
|
||||||
|
|
||||||
|
@ -74,13 +75,13 @@ class CallbackModule(CallbackBase):
|
||||||
|
|
||||||
def v2_runner_on_ok(self, result):
|
def v2_runner_on_ok(self, result):
|
||||||
|
|
||||||
|
delegated_vars = result._result.get('_ansible_delegated_vars', None)
|
||||||
|
self._clean_results(result._result, result._task.action)
|
||||||
|
|
||||||
if self._play.strategy == 'free' and self._last_task_banner != result._task._uuid:
|
if self._play.strategy == 'free' and self._last_task_banner != result._task._uuid:
|
||||||
self._print_task_banner(result._task)
|
self._print_task_banner(result._task)
|
||||||
|
|
||||||
self._clean_results(result._result, result._task.action)
|
|
||||||
|
|
||||||
delegated_vars = result._result.get('_ansible_delegated_vars', None)
|
|
||||||
self._clean_results(result._result, result._task.action)
|
|
||||||
if isinstance(result._task, TaskInclude):
|
if isinstance(result._task, TaskInclude):
|
||||||
return
|
return
|
||||||
elif result._result.get('changed', False):
|
elif result._result.get('changed', False):
|
||||||
|
@ -108,6 +109,10 @@ class CallbackModule(CallbackBase):
|
||||||
|
|
||||||
def v2_runner_on_skipped(self, result):
|
def v2_runner_on_skipped(self, result):
|
||||||
if C.DISPLAY_SKIPPED_HOSTS:
|
if C.DISPLAY_SKIPPED_HOSTS:
|
||||||
|
|
||||||
|
delegated_vars = result._result.get('_ansible_delegated_vars', None)
|
||||||
|
self._clean_results(result._result, result._task.action)
|
||||||
|
|
||||||
if self._play.strategy == 'free' and self._last_task_banner != result._task._uuid:
|
if self._play.strategy == 'free' and self._last_task_banner != result._task._uuid:
|
||||||
self._print_task_banner(result._task)
|
self._print_task_banner(result._task)
|
||||||
|
|
||||||
|
@ -195,6 +200,7 @@ class CallbackModule(CallbackBase):
|
||||||
|
|
||||||
def v2_runner_item_on_ok(self, result):
|
def v2_runner_item_on_ok(self, result):
|
||||||
delegated_vars = result._result.get('_ansible_delegated_vars', None)
|
delegated_vars = result._result.get('_ansible_delegated_vars', None)
|
||||||
|
self._clean_results(result._result, result._task.action)
|
||||||
if isinstance(result._task, TaskInclude):
|
if isinstance(result._task, TaskInclude):
|
||||||
return
|
return
|
||||||
elif result._result.get('changed', False):
|
elif result._result.get('changed', False):
|
||||||
|
@ -218,6 +224,7 @@ class CallbackModule(CallbackBase):
|
||||||
def v2_runner_item_on_failed(self, result):
|
def v2_runner_item_on_failed(self, result):
|
||||||
|
|
||||||
delegated_vars = result._result.get('_ansible_delegated_vars', None)
|
delegated_vars = result._result.get('_ansible_delegated_vars', None)
|
||||||
|
self._clean_results(result._result, result._task.action)
|
||||||
self._handle_exception(result._result)
|
self._handle_exception(result._result)
|
||||||
|
|
||||||
msg = "failed: "
|
msg = "failed: "
|
||||||
|
@ -231,6 +238,7 @@ class CallbackModule(CallbackBase):
|
||||||
|
|
||||||
def v2_runner_item_on_skipped(self, result):
|
def v2_runner_item_on_skipped(self, result):
|
||||||
if C.DISPLAY_SKIPPED_HOSTS:
|
if C.DISPLAY_SKIPPED_HOSTS:
|
||||||
|
self._clean_results(result._result, result._task.action)
|
||||||
msg = "skipping: [%s] => (item=%s) " % (result._host.get_name(), self._get_item(result._result))
|
msg = "skipping: [%s] => (item=%s) " % (result._host.get_name(), self._get_item(result._result))
|
||||||
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and '_ansible_verbose_override' not in result._result:
|
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and '_ansible_verbose_override' not in result._result:
|
||||||
msg += " => %s" % self._dump_results(result._result)
|
msg += " => %s" % self._dump_results(result._result)
|
||||||
|
|
Loading…
Reference in a new issue