From 86a22b5ed29c3d500f107ea1680d87b122a00ca6 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Fri, 22 Oct 2021 01:47:27 -0400 Subject: [PATCH] Fix exception in pkgin module when all packages are already installed (#3583) * Fix exception in pkgin module when all packages are already installed. * Update plugins/modules/packaging/os/pkgin.py Co-authored-by: Felix Fontein * Add changelog fragment for #3583 Co-authored-by: Felix Fontein --- changelogs/fragments/3583-fix-pkgin-exception.yml | 2 ++ plugins/modules/packaging/os/pkgin.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/3583-fix-pkgin-exception.yml diff --git a/changelogs/fragments/3583-fix-pkgin-exception.yml b/changelogs/fragments/3583-fix-pkgin-exception.yml new file mode 100644 index 0000000000..cc61b1187d --- /dev/null +++ b/changelogs/fragments/3583-fix-pkgin-exception.yml @@ -0,0 +1,2 @@ +bugfixes: + - pkgin - Fix exception encountered when all packages are already installed (https://github.com/ansible-collections/community.general/pull/3583). diff --git a/plugins/modules/packaging/os/pkgin.py b/plugins/modules/packaging/os/pkgin.py index 90a711fb6a..dc7204e60d 100644 --- a/plugins/modules/packaging/os/pkgin.py +++ b/plugins/modules/packaging/os/pkgin.py @@ -281,9 +281,9 @@ def install_packages(module, packages): install_c += 1 if install_c > 0: - module.exit_json(changed=True, msg=format_action_message(module, "installed", install_c)) + module.exit_json(changed=True, msg=format_action_message(module, "installed", install_c), stdout=out, stderr=err) - module.exit_json(changed=False, msg="package(s) already present", stdout=out, stderr=err) + module.exit_json(changed=False, msg="package(s) already present") def update_package_db(module):