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

Make the facts module run on netbsd (#15833)

It currently fail with

 ansible/module_utils/facts.py\", line 357, in get_service_mgr_facts\r\nKeyError: 'distribution'\r\n"

Since self.facts['distribution'] is used after, we need to make sure
this is set by default and if needed, corrected somewhere for Linux.
This commit is contained in:
Michael Scherer 2016-05-16 14:02:38 +02:00 committed by Brian Coca
parent 95cf095222
commit e539b2003d

View file

@ -664,15 +664,11 @@ class Distribution(object):
self.facts['distribution_release'] = platform.release()
self.facts['distribution_version'] = platform.version()
systems_platform_working = ('NetBSD', 'FreeBSD')
systems_implemented = ('AIX', 'HP-UX', 'Darwin', 'OpenBSD')
if self.system in systems_platform_working:
# the distribution is provided by platform module already and needs no fixes
pass
self.facts['distribution'] = self.system
elif self.system in systems_implemented:
self.facts['distribution'] = self.system
if self.system in systems_implemented:
cleanedname = self.system.replace('-','')
distfunc = getattr(self, 'get_distribution_'+cleanedname)
distfunc()