Apply display_failed_stderr on loop item results (#74865)
This commit is contained in:
parent
70f22c7f32
commit
01ab6c6ec7
4 changed files with 11 additions and 5 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- Apply ``display_failed_stderr`` callback option on loop item results. (https://github.com/ansible/ansible/issues/74864)
|
|
@ -293,11 +293,15 @@ class CallbackModule(CallbackBase):
|
||||||
|
|
||||||
host_label = self.host_label(result)
|
host_label = self.host_label(result)
|
||||||
self._clean_results(result._result, result._task.action)
|
self._clean_results(result._result, result._task.action)
|
||||||
self._handle_exception(result._result)
|
self._handle_exception(result._result, use_stderr=self.display_failed_stderr)
|
||||||
|
|
||||||
msg = "failed: [%s]" % (host_label,)
|
msg = "failed: [%s]" % (host_label,)
|
||||||
self._handle_warnings(result._result)
|
self._handle_warnings(result._result)
|
||||||
self._display.display(msg + " (item=%s) => %s" % (self._get_item_label(result._result), self._dump_results(result._result)), color=C.COLOR_ERROR)
|
self._display.display(
|
||||||
|
msg + " (item=%s) => %s" % (self._get_item_label(result._result), self._dump_results(result._result)),
|
||||||
|
color=C.COLOR_ERROR,
|
||||||
|
stderr=self.display_failed_stderr
|
||||||
|
)
|
||||||
|
|
||||||
def v2_runner_item_on_skipped(self, result):
|
def v2_runner_item_on_skipped(self, result):
|
||||||
if self.display_skipped_hosts:
|
if self.display_skipped_hosts:
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
+ ansible-playbook -i inventory test.yml
|
+ ansible-playbook -i inventory test.yml
|
||||||
++ set +x
|
++ set +x
|
||||||
fatal: [testhost]: FAILED! => {"changed": false, "msg": "no reason"}
|
fatal: [testhost]: FAILED! => {"changed": false, "msg": "no reason"}
|
||||||
|
failed: [testhost] (item=debug-2) => {
|
||||||
|
"msg": "debug-2"
|
||||||
|
}
|
||||||
fatal: [testhost]: FAILED! => {"msg": "One or more items failed"}
|
fatal: [testhost]: FAILED! => {"msg": "One or more items failed"}
|
||||||
fatal: [testhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"}
|
fatal: [testhost]: FAILED! => {"changed": false, "msg": "Failed as requested from task"}
|
||||||
|
|
|
@ -25,9 +25,6 @@ TASK [debug loop] **************************************************************
|
||||||
changed: [testhost] => (item=debug-1) => {
|
changed: [testhost] => (item=debug-1) => {
|
||||||
"msg": "debug-1"
|
"msg": "debug-1"
|
||||||
}
|
}
|
||||||
failed: [testhost] (item=debug-2) => {
|
|
||||||
"msg": "debug-2"
|
|
||||||
}
|
|
||||||
ok: [testhost] => (item=debug-3) => {
|
ok: [testhost] => (item=debug-3) => {
|
||||||
"msg": "debug-3"
|
"msg": "debug-3"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue