mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
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
This commit is contained in:
parent
2efb692cc4
commit
4e5c9c3d0d
2 changed files with 10 additions and 4 deletions
|
@ -56,6 +56,8 @@ class CallbackModule(CallbackBase):
|
||||||
|
|
||||||
self._display.display(msg, color=C.COLOR_ERROR)
|
self._display.display(msg, color=C.COLOR_ERROR)
|
||||||
|
|
||||||
|
self._handle_warnings(result._result)
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
|
@ -92,6 +94,8 @@ class CallbackModule(CallbackBase):
|
||||||
msg = "ok: [%s]" % result._host.get_name()
|
msg = "ok: [%s]" % result._host.get_name()
|
||||||
color = C.COLOR_OK
|
color = C.COLOR_OK
|
||||||
|
|
||||||
|
self._handle_warnings(result._result)
|
||||||
|
|
||||||
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)
|
||||||
else:
|
else:
|
||||||
|
@ -100,8 +104,6 @@ class CallbackModule(CallbackBase):
|
||||||
msg += " => %s" % (self._dump_results(result._result),)
|
msg += " => %s" % (self._dump_results(result._result),)
|
||||||
self._display.display(msg, color=color)
|
self._display.display(msg, color=color)
|
||||||
|
|
||||||
self._handle_warnings(result._result)
|
|
||||||
|
|
||||||
def v2_runner_on_skipped(self, result):
|
def v2_runner_on_skipped(self, result):
|
||||||
if C.DISPLAY_SKIPPED_HOSTS:
|
if C.DISPLAY_SKIPPED_HOSTS:
|
||||||
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:
|
||||||
|
@ -227,8 +229,8 @@ class CallbackModule(CallbackBase):
|
||||||
else:
|
else:
|
||||||
msg += "[%s]" % (result._host.get_name())
|
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._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):
|
def v2_runner_item_on_skipped(self, result):
|
||||||
if C.DISPLAY_SKIPPED_HOSTS:
|
if C.DISPLAY_SKIPPED_HOSTS:
|
||||||
|
|
|
@ -55,6 +55,8 @@ class CallbackModule(CallbackBase):
|
||||||
|
|
||||||
self._display.display(msg, color=C.COLOR_ERROR)
|
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:
|
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)
|
self._display.display(self._command_generic_msg(result._host.get_name(), result._result, "FAILED"), color=C.COLOR_ERROR)
|
||||||
else:
|
else:
|
||||||
|
@ -62,6 +64,9 @@ class CallbackModule(CallbackBase):
|
||||||
|
|
||||||
def v2_runner_on_ok(self, result):
|
def v2_runner_on_ok(self, result):
|
||||||
self._clean_results(result._result, result._task.action)
|
self._clean_results(result._result, result._task.action)
|
||||||
|
|
||||||
|
self._handle_warnings(result._result)
|
||||||
|
|
||||||
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, "SUCCESS"), color=C.COLOR_OK)
|
self._display.display(self._command_generic_msg(result._host.get_name(), result._result, "SUCCESS"), color=C.COLOR_OK)
|
||||||
else:
|
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)
|
self._display.display("%s | SUCCESS => %s" % (result._host.get_name(), self._dump_results(result._result, indent=4)), color=C.COLOR_CHANGED)
|
||||||
else:
|
else:
|
||||||
self._display.display("%s | SUCCESS => %s" % (result._host.get_name(), self._dump_results(result._result, indent=4)), color=C.COLOR_OK)
|
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):
|
def v2_runner_on_skipped(self, result):
|
||||||
self._display.display("%s | SKIPPED" % (result._host.get_name()), color=C.COLOR_SKIP)
|
self._display.display("%s | SKIPPED" % (result._host.get_name()), color=C.COLOR_SKIP)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue