diff options
Diffstat (limited to 'lib/ansible/module_utils/facts')
-rw-r--r-- | lib/ansible/module_utils/facts/default_collectors.py | 2 | ||||
-rw-r--r-- | lib/ansible/module_utils/facts/system/pkg_mgr.py | 18 |
2 files changed, 15 insertions, 5 deletions
diff --git a/lib/ansible/module_utils/facts/default_collectors.py b/lib/ansible/module_utils/facts/default_collectors.py index f76dc7b7f4..ca53efcc89 100644 --- a/lib/ansible/module_utils/facts/default_collectors.py +++ b/lib/ansible/module_utils/facts/default_collectors.py @@ -33,6 +33,7 @@ from ansible.module_utils.facts.system.fips import FipsFactCollector from ansible.module_utils.facts.system.local import LocalFactCollector from ansible.module_utils.facts.system.lsb import LSBFactCollector from ansible.module_utils.facts.system.pkg_mgr import PkgMgrFactCollector +from ansible.module_utils.facts.system.pkg_mgr import OpenBSDPkgMgrFactCollector from ansible.module_utils.facts.system.platform import PlatformFactCollector from ansible.module_utils.facts.system.python import PythonFactCollector from ansible.module_utils.facts.system.selinux import SelinuxFactCollector @@ -110,6 +111,7 @@ collectors = [ApparmorFactCollector, SunOSNetworkCollector, PkgMgrFactCollector, + OpenBSDPkgMgrFactCollector, PlatformFactCollector, PythonFactCollector, SelinuxFactCollector, diff --git a/lib/ansible/module_utils/facts/system/pkg_mgr.py b/lib/ansible/module_utils/facts/system/pkg_mgr.py index 578a78decc..502dfe8570 100644 --- a/lib/ansible/module_utils/facts/system/pkg_mgr.py +++ b/lib/ansible/module_utils/facts/system/pkg_mgr.py @@ -50,20 +50,28 @@ PKG_MGRS = [{'path': '/usr/bin/yum', 'name': 'yum'}, ] +class OpenBSDPkgMgrFactCollector(BaseFactCollector): + name = 'pkg_mgr' + _fact_ids = set() + _platform = 'OpenBSD' + + def collect(self, module=None, collected_facts=None): + facts_dict = {} + + facts_dict['pkg_mgr'] = 'openbsd_pkg' + return facts_dict + + # the fact ends up being 'pkg_mgr' so stick with that naming/spelling class PkgMgrFactCollector(BaseFactCollector): name = 'pkg_mgr' _fact_ids = set() + _platform = 'Generic' def collect(self, module=None, collected_facts=None): facts_dict = {} collected_facts = collected_facts or {} - pkg_mgr_name = None - if collected_facts.get('system') == 'OpenBSD': - facts_dict['pkg_mgr'] = 'openbsd_pkg' - return facts_dict - pkg_mgr_name = 'unknown' for pkg in PKG_MGRS: if os.path.exists(pkg['path']): |