From e539b2003dd0070d6de00564b6aee4f42d1a88f0 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Mon, 16 May 2016 14:02:38 +0200 Subject: [PATCH] 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. --- lib/ansible/module_utils/facts.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 03121e6814..38d6cb9549 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -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()