From 13deae9b8f3a8f73b000a2f3dab4d3c08963963e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Wed, 18 Nov 2015 17:47:53 +0100 Subject: [PATCH] zypper: Add returncode to result This will be used in integration tssts and makes the whole thing more similar to the yum module. --- lib/ansible/modules/extras/packaging/os/zypper.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/extras/packaging/os/zypper.py b/lib/ansible/modules/extras/packaging/os/zypper.py index 0a693543d4..78c2d489ea 100644 --- a/lib/ansible/modules/extras/packaging/os/zypper.py +++ b/lib/ansible/modules/extras/packaging/os/zypper.py @@ -144,7 +144,7 @@ def get_package_state(m, packages): package = packages[i] if not os.path.isfile(package) and not '://' in package: stderr = "No Package file matching '%s' found on system" % package - m.fail_json(msg=stderr) + m.fail_json(msg=stderr, rc=1) # Get packagename from rpm file cmd = ['/bin/rpm', '--query', '--qf', '%{NAME}', '--package'] cmd.append(package) @@ -311,11 +311,12 @@ def main(): if rc != 0: if stderr: - module.fail_json(msg=stderr) + module.fail_json(msg=stderr, rc=rc) else: - module.fail_json(msg=stdout) + module.fail_json(msg=stdout, rc=rc) result['changed'] = changed + result['rc'] = rc module.exit_json(**result)