From 71de1ee1d5880c7b7226cd147544c7f73bc0a1a6 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Fri, 22 Oct 2021 08:07:10 +0200 Subject: [PATCH] Fix exception in pkgin module when all packages are already installed (#3583) (#3596) * 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 (cherry picked from commit 86a22b5ed29c3d500f107ea1680d87b122a00ca6) Co-authored-by: Nate Coraor --- 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):