From fdbb77da512408311f67c4549786ba81e3b6bb28 Mon Sep 17 00:00:00 2001 From: Casey Fitzpatrick Date: Sun, 8 Jun 2014 19:59:44 -0400 Subject: [PATCH 1/2] fix for svr4pkg module failure reporting, issue #7645 --- library/packaging/svr4pkg | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/library/packaging/svr4pkg b/library/packaging/svr4pkg index 4e790b46c52..6a79497e6b5 100644 --- a/library/packaging/svr4pkg +++ b/library/packaging/svr4pkg @@ -152,7 +152,7 @@ def package_install(module, name, src, proxy, response_file, zone, category): os.unlink(adminfile) return (rc, out, err) -def package_uninstall(module, name, src): +def package_uninstall(module, name, src, category): adminfile = create_admin_file() if category: cmd = [ 'pkgrm', '-na', adminfile, '-Y', name ] @@ -209,10 +209,18 @@ def main(): (rc, out, err) = package_uninstall(module, name, src, category) out = out[:75] - if rc is None: - result['changed'] = False - else: + #Success,Warning,Interruption,Reboot all,Reboot this return codes + if rc is 0 or rc is 2 or rc is 3 or rc is 10 or rc is 20: result['changed'] = True + #no install nor uninstall, or failed + else: + result['changed'] = False + + #Fatal error,Administration,Administration Interaction return codes + if rc is 1 or rc is 4 or rc is 5: + result['failed'] = True + else: + result['failed'] = False if out: result['stdout'] = out From 61325f581718cf10ea490672742f349a0eed31ac Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Mon, 9 Jun 2014 10:48:06 -0500 Subject: [PATCH 2/2] Cleaning up svr4pkg commit fix for #7645 --- library/packaging/svr4pkg | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/library/packaging/svr4pkg b/library/packaging/svr4pkg index 6a79497e6b5..e95d4d8643f 100644 --- a/library/packaging/svr4pkg +++ b/library/packaging/svr4pkg @@ -209,18 +209,18 @@ def main(): (rc, out, err) = package_uninstall(module, name, src, category) out = out[:75] - #Success,Warning,Interruption,Reboot all,Reboot this return codes - if rc is 0 or rc is 2 or rc is 3 or rc is 10 or rc is 20: + # Success, Warning, Interruption, Reboot all, Reboot this return codes + if rc in (0, 2, 3, 10, 20): result['changed'] = True - #no install nor uninstall, or failed + # no install nor uninstall, or failed else: result['changed'] = False - - #Fatal error,Administration,Administration Interaction return codes - if rc is 1 or rc is 4 or rc is 5: - result['failed'] = True + + # Fatal error, Administration, Administration Interaction return codes + if rc in (1, 4 , 5): + result['failed'] = True else: - result['failed'] = False + result['failed'] = False if out: result['stdout'] = out