From d4ac73a1bc3c09b7a5d7036d138f73584fadeb94 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Fri, 17 Jul 2015 13:44:22 -0400 Subject: [PATCH] Adding back capability to display warnings contained in results Fixes #11255 --- lib/ansible/plugins/callback/default.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ansible/plugins/callback/default.py b/lib/ansible/plugins/callback/default.py index cff5fa1ad7..b3ac6ca8dd 100644 --- a/lib/ansible/plugins/callback/default.py +++ b/lib/ansible/plugins/callback/default.py @@ -19,6 +19,7 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type +from ansible import constants as C from ansible.plugins.callback import CallbackBase class CallbackModule(CallbackBase): @@ -71,6 +72,11 @@ class CallbackModule(CallbackBase): msg += " => %s" % self._dump_results(result._result, indent=indent) 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): msg = "skipping: [%s]" % result._host.get_name() if self._display.verbosity > 0 or 'verbose_always' in result._result: