From 2fedeb9834b2dae8d22038c866063e395d3ca232 Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 12 Dec 2018 10:41:28 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E4=BF=AE=E6=94=B9=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/ops/ansible/callback.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/ops/ansible/callback.py b/apps/ops/ansible/callback.py index f3e60a458..16e220e57 100644 --- a/apps/ops/ansible/callback.py +++ b/apps/ops/ansible/callback.py @@ -178,7 +178,13 @@ class CommandResultCallback(AdHocResultCallback): def v2_runner_on_failed(self, result, ignore_errors=False): self.results_summary['success'] = False self.gather_result("failed", result) - msg = result._result.get("msg") or result._result.get("module_stdout") + msg = result._result.get("msg", '') + stderr = result._result.get("stderr") + if stderr: + msg += '\n' + stderr + module_stdout = result._result.get("module_stdout") + if module_stdout: + msg += '\n' + module_stdout if not msg: msg = json.dumps(result._result, indent=4) self._display.display("%s | FAILED! => \n%s" % (