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
This commit is contained in:
Yann Autissier 2016-08-22 12:36:22 +02:00 committed by Brian Coca
parent 8e38f7475f
commit c048198567

View file

@ -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):