From 474df33ff3996e4b019ba803b50489bd6626ecc1 Mon Sep 17 00:00:00 2001 From: Dagobert Michelsen Date: Sat, 31 Jan 2015 22:12:40 +0100 Subject: [PATCH] Correctly report "changed: false" when trying to install a package not in the catalog. This fixes #230 --- lib/ansible/modules/extras/packaging/os/pkgutil.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/extras/packaging/os/pkgutil.py b/lib/ansible/modules/extras/packaging/os/pkgutil.py index 78a7db72bf5..fe0e82a5ab7 100644 --- a/lib/ansible/modules/extras/packaging/os/pkgutil.py +++ b/lib/ansible/modules/extras/packaging/os/pkgutil.py @@ -162,10 +162,15 @@ def main(): (rc, out, err) = package_uninstall(module, name) out = out[:75] - if rc is None: + if rc == 0: + result['changed'] = True + else: result['changed'] = False + + if rc is not None and rc != 0: + result['failed'] = True else: - result['changed'] = True + result['failed'] = False if out: result['stdout'] = out