Ensure apt is used on ubuntu hosts with zypper

There is an issue with our nb0* hosts where they have zypper installed
for building suse images but that tricks ansible in to thinking it
should use zypper for package management.

This has been submitted upstream as
https://github.com/ansible/ansible/pull/44413

Change-Id: I96f60501e43bfe9c6acb4ce80f8450b245943ca8
This commit is contained in:
Monty Taylor 2018-08-20 13:17:36 -05:00
parent ac3d9d4651
commit 1b54971705
1 changed files with 5 additions and 0 deletions

View File

@ -126,6 +126,11 @@ class PkgMgrFactCollector(BaseFactCollector):
if pkg_mgr_name == 'apt':
pkg_mgr_name = 'apt_rpm'
elif collected_facts['ansible_os_family'] == 'Debian' and pkg_mgr_name != 'apt':
# It's possible to install yum, dnf, zypper, rpm, etc inside of
# Debian. Doing so does not mean the system wants to use them.
pkg_mgr_name = 'apt'
# Check if /usr/bin/apt-get is ordinary (dpkg-based) APT or APT-RPM
if pkg_mgr_name == 'apt':
pkg_mgr_name = self._check_apt_flavor(pkg_mgr_name)