From 7acc0a632bc1edcabdc60bba0a54d3b9769880bb Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Tue, 2 Oct 2012 21:45:42 +0200 Subject: [PATCH] Make fatal errors red --- lib/ansible/callbacks.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/ansible/callbacks.py b/lib/ansible/callbacks.py index dcf11a6b11..0e281b8e38 100644 --- a/lib/ansible/callbacks.py +++ b/lib/ansible/callbacks.py @@ -281,15 +281,16 @@ class PlaybookRunnerCallbacks(DefaultRunnerCallbacks): self.stats = stats self._async_notified = {} - def on_unreachable(self, host, msg): + def on_unreachable(self, host, results): item = None - if type(msg) == dict: - item = msg.get('item', None) + if type(results) == dict: + item = results.get('item', None) if item: - print "fatal: [%s] => (item=%s) => %s" % (host, item, msg) + msg = "fatal: [%s] => (item=%s) => %s" % (host, item, results) else: - print "fatal: [%s] => %s" % (host, msg) - super(PlaybookRunnerCallbacks, self).on_unreachable(host, msg) + msg = "fatal: [%s] => %s" % (host, results) + print stringc(msg, 'red') + super(PlaybookRunnerCallbacks, self).on_unreachable(host, results) def on_failed(self, host, results, ignore_errors=False):