From c0048007a970f719909f588e3ad8802ec647e931 Mon Sep 17 00:00:00 2001 From: uwila Date: Tue, 24 Jul 2018 01:58:42 +0200 Subject: [PATCH] Detect failed sysvinit module (#43127) * Detect failed sysvinit module - This checks the stderr instead of the rc to detect whether the sysvinit module was successful or not, as even when failing, the rc would be 0. - It immediatly became obvious that the debug info when failing was far too little to properly debug the role. To improve this, I also added the rc, stderr and stdout to the debug output. * Revert stderr check to rc check, rename out->stdout, err->stderr --- lib/ansible/modules/system/sysvinit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/system/sysvinit.py b/lib/ansible/modules/system/sysvinit.py index c39e2866ec..a5067838c8 100644 --- a/lib/ansible/modules/system/sysvinit.py +++ b/lib/ansible/modules/system/sysvinit.py @@ -311,7 +311,7 @@ def main(): # FIXME: ERRORS if rc != 0: - module.fail_json(msg="Failed to %s service: %s" % (action, name)) + module.fail_json(msg="Failed to %s service: %s" % (action, name), rc=rc, stdout=out, stderr=err) return (rc, out, err)