From 31ce8bc3a2ac3dc5844de5c9950339e2772c13eb Mon Sep 17 00:00:00 2001 From: Marcus Furlong Date: Thu, 18 Feb 2016 14:36:52 +1100 Subject: [PATCH] fix ansible_os_family fact on openSUSE Leap ansible_os_family on openSUSE Leap has the wrong value: "ansible_os_family": "openSUSE Leap", It should be: "ansible_os_family": "Suse", This change fixes that by adding the relevant key and ensuring that dict lookups replace ' ' with '_' so the key does not contain a space. --- lib/ansible/module_utils/facts.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 3d89294e5ec..592e4a58458 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -274,7 +274,7 @@ class Facts(object): Archlinux = 'Archlinux', Manjaro = 'Archlinux', Mandriva = 'Mandrake', Mandrake = 'Mandrake', Altlinux = 'Altlinux', Solaris = 'Solaris', Nexenta = 'Solaris', OmniOS = 'Solaris', OpenIndiana = 'Solaris', SmartOS = 'Solaris', AIX = 'AIX', Alpine = 'Alpine', MacOSX = 'Darwin', - FreeBSD = 'FreeBSD', HPUX = 'HP-UX' + FreeBSD = 'FreeBSD', HPUX = 'HP-UX', openSUSE_Leap = 'Suse' ) # TODO: Rewrite this to use the function references in a dict pattern @@ -511,8 +511,9 @@ class Facts(object): machine_id = machine_id.split('\n')[0] self.facts["machine_id"] = machine_id self.facts['os_family'] = self.facts['distribution'] - if self.facts['distribution'] in OS_FAMILY: - self.facts['os_family'] = OS_FAMILY[self.facts['distribution']] + distro = self.facts['distribution'].replace(' ', '_') + if distro in OS_FAMILY: + self.facts['os_family'] = OS_FAMILY[distro] def get_cmdline(self): data = get_file_content('/proc/cmdline')