Commit d4ac73a1 by James Cammarata

Adding back capability to display warnings contained in results

Fixes #11255
parent 5abdd3b8
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
from ansible import constants as C
from ansible.plugins.callback import CallbackBase from ansible.plugins.callback import CallbackBase
class CallbackModule(CallbackBase): class CallbackModule(CallbackBase):
...@@ -71,6 +72,11 @@ class CallbackModule(CallbackBase): ...@@ -71,6 +72,11 @@ class CallbackModule(CallbackBase):
msg += " => %s" % self._dump_results(result._result, indent=indent) msg += " => %s" % self._dump_results(result._result, indent=indent)
self._display.display(msg, color=color) self._display.display(msg, color=color)
# display warnings, if enabled and any exist in the result
if C.COMMAND_WARNINGS and 'warnings' in result._result and result._result['warnings']:
for warning in result._result['warnings']:
self._display.display("warning: %s" % warning, color='purple')
def v2_runner_on_skipped(self, result): def v2_runner_on_skipped(self, result):
msg = "skipping: [%s]" % result._host.get_name() msg = "skipping: [%s]" % result._host.get_name()
if self._display.verbosity > 0 or 'verbose_always' in result._result: if self._display.verbosity > 0 or 'verbose_always' in result._result:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment