1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
class TestSELinuxEnabled(TestBase):
"""
Test that selinux is enabled, by calling selinuxenabled
"""
class ErrorNotEnabled(ErrorBase):
def __str__(self):
return "SELinux is not enabled."
class ErrorCouldNotTest(ErrorBase):
def __str__(self):
return "Couldn't test if selinux is enabled."
@staticmethod
def test():
import os
status = os.system("selinuxenabled")
if not os.WIFEXITED(status):
return [TestSELinuxEnabled.ErrorCouldNotTest()]
exitcode = os.WEXITSTATUS(status)
if exitcode != 0:
return [TestSELinuxEnabled.ErrorNotEnabled()]
return []
register_test(TestSELinuxEnabled)
|