default and minimal callback: display warnings in a consistent manner (#21144)

* default/minimal callback: don't display warnings twice

* minimal callback: display warnings raised by MODULE_NO_JSON modules
pull/21154/head
Pilou 8 years ago committed by Brian Coca
parent 2efb692cc4
commit 4e5c9c3d0d

@ -56,6 +56,8 @@ class CallbackModule(CallbackBase):
self._display.display(msg, color=C.COLOR_ERROR)
self._handle_warnings(result._result)
if result._task.loop and 'results' in result._result:
self._process_items(result)
@ -92,6 +94,8 @@ class CallbackModule(CallbackBase):
msg = "ok: [%s]" % result._host.get_name()
color = C.COLOR_OK
self._handle_warnings(result._result)
if result._task.loop and 'results' in result._result:
self._process_items(result)
else:
@ -100,8 +104,6 @@ class CallbackModule(CallbackBase):
msg += " => %s" % (self._dump_results(result._result),)
self._display.display(msg, color=color)
self._handle_warnings(result._result)
def v2_runner_on_skipped(self, result):
if C.DISPLAY_SKIPPED_HOSTS:
if self._play.strategy == 'free' and self._last_task_banner != result._task._uuid:
@ -227,8 +229,8 @@ class CallbackModule(CallbackBase):
else:
msg += "[%s]" % (result._host.get_name())
self._display.display(msg + " (item=%s) => %s" % (self._get_item(result._result), self._dump_results(result._result)), color=C.COLOR_ERROR)
self._handle_warnings(result._result)
self._display.display(msg + " (item=%s) => %s" % (self._get_item(result._result), self._dump_results(result._result)), color=C.COLOR_ERROR)
def v2_runner_item_on_skipped(self, result):
if C.DISPLAY_SKIPPED_HOSTS:

@ -55,6 +55,8 @@ class CallbackModule(CallbackBase):
self._display.display(msg, color=C.COLOR_ERROR)
self._handle_warnings(result._result)
if result._task.action in C.MODULE_NO_JSON and 'module_stderr' not in result._result:
self._display.display(self._command_generic_msg(result._host.get_name(), result._result, "FAILED"), color=C.COLOR_ERROR)
else:
@ -62,6 +64,9 @@ class CallbackModule(CallbackBase):
def v2_runner_on_ok(self, result):
self._clean_results(result._result, result._task.action)
self._handle_warnings(result._result)
if result._task.action in C.MODULE_NO_JSON:
self._display.display(self._command_generic_msg(result._host.get_name(), result._result, "SUCCESS"), color=C.COLOR_OK)
else:
@ -69,7 +74,6 @@ class CallbackModule(CallbackBase):
self._display.display("%s | SUCCESS => %s" % (result._host.get_name(), self._dump_results(result._result, indent=4)), color=C.COLOR_CHANGED)
else:
self._display.display("%s | SUCCESS => %s" % (result._host.get_name(), self._dump_results(result._result, indent=4)), color=C.COLOR_OK)
self._handle_warnings(result._result)
def v2_runner_on_skipped(self, result):
self._display.display("%s | SKIPPED" % (result._host.get_name()), color=C.COLOR_SKIP)

Loading…
Cancel
Save