From 724a0c867e9c44199f2b50d888f1291aa4d7c11c Mon Sep 17 00:00:00 2001 From: Alex Haydock Date: Wed, 19 May 2021 21:15:26 +0100 Subject: [PATCH] Fix mistaken detection of atomic_container when rpm-ostree is present (fixes #74578) (#74579) * Lower the priority of the atomic_container detection now that we have #73445 merged * Add changelog fragment --- changelogs/fragments/74578-fix-ostree-detection.yml | 2 ++ lib/ansible/module_utils/facts/system/pkg_mgr.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/74578-fix-ostree-detection.yml diff --git a/changelogs/fragments/74578-fix-ostree-detection.yml b/changelogs/fragments/74578-fix-ostree-detection.yml new file mode 100644 index 00000000000..2ba69f612a5 --- /dev/null +++ b/changelogs/fragments/74578-fix-ostree-detection.yml @@ -0,0 +1,2 @@ +bugfixes: + - pkg_mgr.py - Lower the priority of rpm-ostree detection to avoid false positives on systems not using it as the main package manager (https://github.com/ansible/ansible/issues/74578) \ No newline at end of file diff --git a/lib/ansible/module_utils/facts/system/pkg_mgr.py b/lib/ansible/module_utils/facts/system/pkg_mgr.py index 664c362e40d..f290563cf87 100644 --- a/lib/ansible/module_utils/facts/system/pkg_mgr.py +++ b/lib/ansible/module_utils/facts/system/pkg_mgr.py @@ -13,7 +13,8 @@ from ansible.module_utils.facts.collector import BaseFactCollector # A list of dicts. If there is a platform with more than one # package manager, put the preferred one last. If there is an # ansible module, use that as the value for the 'name' key. -PKG_MGRS = [{'path': '/usr/bin/yum', 'name': 'yum'}, +PKG_MGRS = [{'path': '/usr/bin/rpm-ostree', 'name': 'atomic_container'}, + {'path': '/usr/bin/yum', 'name': 'yum'}, {'path': '/usr/bin/dnf', 'name': 'dnf'}, {'path': '/usr/bin/apt-get', 'name': 'apt'}, {'path': '/usr/bin/zypper', 'name': 'zypper'}, @@ -36,7 +37,6 @@ PKG_MGRS = [{'path': '/usr/bin/yum', 'name': 'yum'}, {'path': '/usr/local/sbin/pkg', 'name': 'pkgng'}, {'path': '/usr/bin/swupd', 'name': 'swupd'}, {'path': '/usr/sbin/sorcery', 'name': 'sorcery'}, - {'path': '/usr/bin/rpm-ostree', 'name': 'atomic_container'}, {'path': '/usr/bin/installp', 'name': 'installp'}, {'path': '/QOpenSys/pkgs/bin/yum', 'name': 'yum'}, ]