From 2482c687b7f4cb3b513cb8b21a3ac23d406a87f7 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Fri, 3 Jun 2016 09:18:20 -0400 Subject: [PATCH] optimize openbsd pkg_mgr fact discovery --- lib/ansible/module_utils/facts.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index d3faeaae2a..2fb44db97b 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -334,12 +334,13 @@ class Facts(object): self.facts[factname] = keydata.split()[1] def get_pkg_mgr_facts(self): - self.facts['pkg_mgr'] = 'unknown' - for pkg in Facts.PKG_MGRS: - if os.path.exists(pkg['path']): - self.facts['pkg_mgr'] = pkg['name'] if self.facts['system'] == 'OpenBSD': self.facts['pkg_mgr'] = 'openbsd_pkg' + else: + self.facts['pkg_mgr'] = 'unknown' + for pkg in Facts.PKG_MGRS: + if os.path.exists(pkg['path']): + self.facts['pkg_mgr'] = pkg['name'] def get_service_mgr_facts(self): #TODO: detect more custom init setups like bootscripts, dmd, s6, Epoch, runit, etc