From c04819856790c07f75fbabba107e73be03819c2f Mon Sep 17 00:00:00 2001 From: Yann Autissier Date: Mon, 22 Aug 2016 12:36:22 +0200 Subject: [PATCH] fix setup module on Fedora Core 5 (#17175) setup module fails with AttributeError: 'module' object has no attribute 'selinux_getpolicytype' in get_selinux_facts on Fedora Core 5 --- lib/ansible/module_utils/facts.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index d8deaf9a60..79174d2df4 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -427,7 +427,7 @@ class Facts(object): self.facts['selinux']['status'] = 'enabled' try: self.facts['selinux']['policyvers'] = selinux.security_policyvers() - except OSError: + except (AttributeError,OSError): self.facts['selinux']['policyvers'] = 'unknown' try: (rc, configmode) = selinux.selinux_getenforcemode() @@ -435,12 +435,12 @@ class Facts(object): self.facts['selinux']['config_mode'] = Facts.SELINUX_MODE_DICT.get(configmode, 'unknown') else: self.facts['selinux']['config_mode'] = 'unknown' - except OSError: + except (AttributeError,OSError): self.facts['selinux']['config_mode'] = 'unknown' try: mode = selinux.security_getenforce() self.facts['selinux']['mode'] = Facts.SELINUX_MODE_DICT.get(mode, 'unknown') - except OSError: + except (AttributeError,OSError): self.facts['selinux']['mode'] = 'unknown' try: (rc, policytype) = selinux.selinux_getpolicytype() @@ -448,7 +448,7 @@ class Facts(object): self.facts['selinux']['type'] = policytype else: self.facts['selinux']['type'] = 'unknown' - except OSError: + except (AttributeError,OSError): self.facts['selinux']['type'] = 'unknown' def get_caps_facts(self):