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):