Commit c30e4643 by James Cammarata

Additional tweaks to callback output for delegate_to

parent 51361986
...@@ -50,7 +50,10 @@ class CallbackModule(CallbackBase): ...@@ -50,7 +50,10 @@ class CallbackModule(CallbackBase):
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:
self._display.display("fatal: [%s]: FAILED! => %s" % (result._host.get_name(), self._dump_results(result._result)), color='red') if result._task.delegate_to:
self._display.display("fatal: [%s -> %s]: FAILED! => %s" % (result._host.get_name(), result._task.delegate_to, self._dump_results(result._result)), color='red')
else:
self._display.display("fatal: [%s]: FAILED! => %s" % (result._host.get_name(), self._dump_results(result._result)), color='red')
if result._task.ignore_errors: if result._task.ignore_errors:
self._display.display("...ignoring", color='cyan') self._display.display("...ignoring", color='cyan')
...@@ -62,13 +65,13 @@ class CallbackModule(CallbackBase): ...@@ -62,13 +65,13 @@ class CallbackModule(CallbackBase):
color = 'cyan' color = 'cyan'
elif result._result.get('changed', False): elif result._result.get('changed', False):
if result._task.delegate_to is not None: if result._task.delegate_to is not None:
msg = "changed: [%s => %s]" % (result._host.get_name(), result._task.delegate_to) msg = "changed: [%s -> %s]" % (result._host.get_name(), result._task.delegate_to)
else: else:
msg = "changed: [%s]" % result._host.get_name() msg = "changed: [%s]" % result._host.get_name()
color = 'yellow' color = 'yellow'
else: else:
if result._task.delegate_to is not None: if result._task.delegate_to is not None:
msg = "ok: [%s => %s]" % (result._host.get_name(), result._task.delegate_to) msg = "ok: [%s -> %s]" % (result._host.get_name(), result._task.delegate_to)
else: else:
msg = "ok: [%s]" % result._host.get_name() msg = "ok: [%s]" % result._host.get_name()
color = 'green' color = 'green'
...@@ -91,7 +94,10 @@ class CallbackModule(CallbackBase): ...@@ -91,7 +94,10 @@ class CallbackModule(CallbackBase):
self._display.display(msg, color='cyan') self._display.display(msg, color='cyan')
def v2_runner_on_unreachable(self, result): def v2_runner_on_unreachable(self, result):
self._display.display("fatal: [%s]: UNREACHABLE! => %s" % (result._host.get_name(), self._dump_results(result._result)), color='red') if result._task.delegate_to:
self._display.display("fatal: [%s -> %s]: UNREACHABLE! => %s" % (result._host.get_name(), result._task.delegate_to, self._dump_results(result._result)), color='red')
else:
self._display.display("fatal: [%s]: UNREACHABLE! => %s" % (result._host.get_name(), self._dump_results(result._result)), color='red')
def v2_playbook_on_no_hosts_matched(self): def v2_playbook_on_no_hosts_matched(self):
self._display.display("skipping: no hosts matched", color='cyan') self._display.display("skipping: no hosts matched", color='cyan')
......
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