Bug 8275 - SELinux error message provides incorrect directions

status 8275: resloved fixed
This commit is contained in:
Frank 2011-02-07 13:39:08 -08:00
parent 3343aa890f
commit c38aff60f4
2 changed files with 13 additions and 4 deletions

View File

@ -298,12 +298,22 @@ def check_selinux():
if "nforcing" in output:
enforcing = True
if any ( [ s.startswith("SELINUX=enforcing") for s in file("/etc/selinux/config").readlines() ] ):
enforcing = True
config_enforcing = True
else:
config_enforcing = False
except (IOError,OSError),e:
if e.errno == 2: pass
else: raise CheckFailed("An unknown error (%s) took place while checking for SELinux"%str(e))
if enforcing:
raise CheckFailed("SELinux is set to enforcing, please set it to permissive in /etc/selinux/config, then reboot the machine or type setenforce Permissive, after which you can run this program again.")
raise CheckFailed('''SELinux is set to enforcing. There are two options:
1> Set it permissive in /etc/selinux/config, then reboot the machine.
2> Type 'setenforce Permissive' in commandline, after which you can run this program again.
We strongly suggest you doing the option 1 that makes sure SELinux goes into permissive after system reboot.\n''')
if config_enforcing:
print "WARNING: We detected that your SELinux is not configured in permissive. to make sure cloudstack won't block by \
SELinux after system reboot, we strongly suggest you setting it in permissive in /etc/selinux/config, then reboot the machine."
def preflight_checks(do_check_kvm=True):

View File

@ -216,8 +216,7 @@ def checkselinux():
try:
check_selinux()
except CheckFailed,e:
sys.stderr.write("SELINUX is set to enforcing, please set it to permissive in /etc/selinux/config\n")
sys.stderr.write("then reboot the machine, after which you can run this program again.\n")
sys.stderr.write(e.__str__())
sys.exit(3)
def checknetwork():