Skip to content

Commit

Permalink
Fix service_mgr fact collection (#32086)
Browse files Browse the repository at this point in the history
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
(cherry picked from commit 6203e89)
  • Loading branch information
alikins authored and abadger committed Oct 26, 2017
1 parent 7a29189 commit 0d10130
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/ansible/module_utils/facts/system/service_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,22 @@ def collect(self, module=None, collected_facts=None):

# 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'
Expand Down

0 comments on commit 0d10130

Please sign in to comment.