Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37709134
en ru br
ALT Linux repositórios
S:2.9.27-alt3

Group :: Sistema/Configurações/Rede
RPM: ansible

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: ansible-prohibit-pkg5-usage.patch
Download


diff --git a/lib/ansible/module_utils/facts/system/pkg_mgr.py b/lib/ansible/module_utils/facts/system/pkg_mgr.py
index f290563cf878a..c8980f56686b8 100644
--- a/lib/ansible/module_utils/facts/system/pkg_mgr.py
+++ b/lib/ansible/module_utils/facts/system/pkg_mgr.py
@@ -113,12 +113,22 @@ def _check_apt_flavor(self, pkg_mgr_name):
                     pkg_mgr_name = 'apt'
         return pkg_mgr_name
 
+    def pkg_mgrs(self, collected_facts):
+        # Filter out the /usr/bin/pkg because on Altlinux it is actually the
+        # perl-Package (not Solaris package manager).
+        # Since the pkg5 takes precedence over apt, this workaround
+        # is required to select the suitable package manager on Altlinux.
+        if collected_facts['ansible_os_family'] == 'Altlinux':
+            return filter(lambda pkg: pkg['path'] != '/usr/bin/pkg', PKG_MGRS)
+        else:
+            return PKG_MGRS
+
     def collect(self, module=None, collected_facts=None):
         facts_dict = {}
         collected_facts = collected_facts or {}
 
         pkg_mgr_name = 'unknown'
-        for pkg in PKG_MGRS:
+        for pkg in self.pkg_mgrs(collected_facts):
             if os.path.exists(pkg['path']):
                 pkg_mgr_name = pkg['name']
 
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009