From 1ff15373293c591219ee14db644152e5e519635b Mon Sep 17 00:00:00 2001 From: Dagobert Michelsen Date: Wed, 18 Feb 2015 10:33:21 +0100 Subject: [PATCH] Adjust setting to better make logic clearer --- lib/ansible/modules/extras/packaging/os/pkgutil.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/ansible/modules/extras/packaging/os/pkgutil.py b/lib/ansible/modules/extras/packaging/os/pkgutil.py index fe0e82a5ab7..0204bbae987 100644 --- a/lib/ansible/modules/extras/packaging/os/pkgutil.py +++ b/lib/ansible/modules/extras/packaging/os/pkgutil.py @@ -162,15 +162,14 @@ def main(): (rc, out, err) = package_uninstall(module, name) out = out[:75] - if rc == 0: - result['changed'] = True - else: + if rc is None: + # pkgutil was not executed because the package was already present/absent + result['changed'] = False + elif rc == 0 + result['changed'] = True + else result['changed'] = False - - if rc is not None and rc != 0: result['failed'] = True - else: - result['failed'] = False if out: result['stdout'] = out