1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

correctly detect pkg_mgr on fedora/rhel/centos rpm-ostree installed (#49256)

Check the path /run/ostree-booted which I'm told by upstream that it
will always be present when a host system is Fedora/RHEL/CentOS
Atomic/CoreOS vs "traditional" distro instance to detect the
non-traditional instance and ensure pkg_mgr selection is correct

Signed-off-by: Adam Miller <admiller@redhat.com>
This commit is contained in:
Adam Miller 2019-02-07 14:16:38 -06:00 committed by Sam Doran
parent 959939b866
commit 9bb05b72b2
2 changed files with 4 additions and 0 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "facts - properly detect package manager for a Fedora/RHEL/CentOS system that has rpm-ostree installed"

View file

@ -61,6 +61,8 @@ class PkgMgrFactCollector(BaseFactCollector):
def _check_rh_versions(self, pkg_mgr_name, collected_facts): def _check_rh_versions(self, pkg_mgr_name, collected_facts):
if collected_facts['ansible_distribution'] == 'Fedora': if collected_facts['ansible_distribution'] == 'Fedora':
if os.path.exists('/run/ostree-booted'):
return "atomic_container"
try: try:
if int(collected_facts['ansible_distribution_major_version']) < 23: if int(collected_facts['ansible_distribution_major_version']) < 23:
for yum in [pkg_mgr for pkg_mgr in PKG_MGRS if pkg_mgr['name'] == 'yum']: for yum in [pkg_mgr for pkg_mgr in PKG_MGRS if pkg_mgr['name'] == 'yum']: