1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fixed ansible_os_family variable on OS X (#15768) (#15773)

Fixed `ansible_os_family` variable on OS X
This commit is contained in:
Pomin Wu 2016-05-09 21:59:26 +08:00 committed by Brian Coca
parent 848b015ce6
commit 78808fc4cc

View file

@ -179,7 +179,7 @@ class Facts(object):
# about those first. # about those first.
if load_on_init: if load_on_init:
self.get_platform_facts() self.get_platform_facts()
self.facts.update(Distribution().populate()) self.facts.update(Distribution(module).populate())
self.get_cmdline() self.get_cmdline()
self.get_public_ssh_host_keys() self.get_public_ssh_host_keys()
self.get_selinux_facts() self.get_selinux_facts()
@ -647,17 +647,19 @@ class Distribution(object):
FreeBSD = 'FreeBSD', HPUX = 'HP-UX', openSUSE_Leap = 'Suse' FreeBSD = 'FreeBSD', HPUX = 'HP-UX', openSUSE_Leap = 'Suse'
) )
def __init__(self): def __init__(self, module):
self.system = platform.system() self.system = platform.system()
self.facts = {} self.facts = {}
self.module = module
def populate(self): def populate(self):
if self.system == 'Linux': if self.system == 'Linux':
self.get_distribution_facts() self.get_distribution_facts()
elif self.system == 'Darwin':
self.get_distribution_facts()
return self.facts return self.facts
def get_distribution_facts(self): def get_distribution_facts(self):
# The platform module provides information about the running # The platform module provides information about the running
# system/distribution. Use this as a baseline and fix buggy systems # system/distribution. Use this as a baseline and fix buggy systems
# afterwards # afterwards