From 12b39987a01834820bf2197fabddfa50d5a3908a Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Mon, 22 Apr 2024 06:53:24 +0200 Subject: [PATCH] [stable-2.7] apt_rpm: fix package install check (#8263) (#8271) apt_rpm: fix package install check (#8263) Fix package install check. (cherry picked from commit 17e11d7d7e1ddd6bf3e73536a464aea08fd20084) --- 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 4c632a6fd2..78643292a4 100644 --- a/plugins/modules/apt_rpm.py +++ b/plugins/modules/apt_rpm.py @@ -204,7 +204,7 @@ def install_packages(module, pkgspec): 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): installed = False