From 0299b31416ac4afbb31f5a8d4e34bccffae67649 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 22 Apr 2024 06:51:56 +0200 Subject: [PATCH] [PR #8263/17e11d7d backport][stable-8] apt_rpm: fix package install check (#8270) apt_rpm: fix package install check (#8263) Fix package install check. (cherry picked from commit 17e11d7d7e1ddd6bf3e73536a464aea08fd20084) Co-authored-by: Felix Fontein --- changelogs/fragments/8263-apt_rpm-install-check.yml | 2 ++ plugins/modules/apt_rpm.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/8263-apt_rpm-install-check.yml diff --git a/changelogs/fragments/8263-apt_rpm-install-check.yml b/changelogs/fragments/8263-apt_rpm-install-check.yml new file mode 100644 index 0000000000..ae44616e79 --- /dev/null +++ b/changelogs/fragments/8263-apt_rpm-install-check.yml @@ -0,0 +1,2 @@ +bugfixes: + - "apt_rpm - when checking whether packages were installed after running ``apt-get -y install ``, only the last package name was checked (https://github.com/ansible-collections/community.general/pull/8263)." diff --git a/plugins/modules/apt_rpm.py b/plugins/modules/apt_rpm.py index 3f90365bb3..03b87e78f0 100644 --- a/plugins/modules/apt_rpm.py +++ b/plugins/modules/apt_rpm.py @@ -281,7 +281,7 @@ def install_packages(module, pkgspec, allow_upgrade=False): rc, out, err = module.run_command("%s -y install %s" % (APT_PATH, packages), environ_update={"LANG": "C"}) installed = True - for packages in pkgspec: + for package in pkgspec: if not query_package_provides(module, package, allow_upgrade=False): installed = False