From 6203e899f03a923251e5cae72db3648aa4f02eee Mon Sep 17 00:00:00 2001 From: Adrian Likins Date: Tue, 24 Oct 2017 15:15:01 -0400 Subject: [PATCH] Fix service_mgr fact collection (#32086) The platform/distro/etc facts were being passed in correctly, but service_mgr.py was looking up the wrong names ('system' vs 'ansible_system') resulting in service_mgr falling back to default 'service' result. Fixes #30753, #31095 --- lib/ansible/module_utils/facts/system/service_mgr.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ansible/module_utils/facts/system/service_mgr.py b/lib/ansible/module_utils/facts/system/service_mgr.py index ff7ee7ab4a..d983604cdb 100644 --- a/lib/ansible/module_utils/facts/system/service_mgr.py +++ b/lib/ansible/module_utils/facts/system/service_mgr.py @@ -105,22 +105,22 @@ class ServiceMgrFactCollector(BaseFactCollector): # FIXME: replace with a system->service_mgr_name map? # start with the easy ones - elif collected_facts.get('distribution', None) == 'MacOSX': + elif collected_facts.get('ansible_distribution', None) == 'MacOSX': # FIXME: find way to query executable, version matching is not ideal if LooseVersion(platform.mac_ver()[0]) >= LooseVersion('10.4'): service_mgr_name = 'launchd' else: service_mgr_name = 'systemstarter' - elif 'BSD' in collected_facts.get('system', '') or collected_facts.get('system') in ['Bitrig', 'DragonFly']: + elif 'BSD' in collected_facts.get('ansible_system', '') or collected_facts.get('ansible_system') in ['Bitrig', 'DragonFly']: # FIXME: we might want to break out to individual BSDs or 'rc' service_mgr_name = 'bsdinit' - elif collected_facts.get('system') == 'AIX': + elif collected_facts.get('ansible_system') == 'AIX': service_mgr_name = 'src' - elif collected_facts.get('system') == 'SunOS': + elif collected_facts.get('ansible_system') == 'SunOS': service_mgr_name = 'smf' - elif collected_facts.get('distribution') == 'OpenWrt': + elif collected_facts.get('ansible_distribution') == 'OpenWrt': service_mgr_name = 'openwrt_init' - elif collected_facts.get('system') == 'Linux': + elif collected_facts.get('ansible_system') == 'Linux': # FIXME: mv is_systemd_managed if self.is_systemd_managed(module=module): service_mgr_name = 'systemd'