Skip to content

Commit c38aff6

Browse files
committed
Bug 8275 - SELinux error message provides incorrect directions
status 8275: resloved fixed
1 parent 3343aa8 commit c38aff6

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

python/lib/cloud_utils.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,22 @@ def check_selinux():
298298
if "nforcing" in output:
299299
enforcing = True
300300
if any ( [ s.startswith("SELINUX=enforcing") for s in file("/etc/selinux/config").readlines() ] ):
301-
enforcing = True
301+
config_enforcing = True
302+
else:
303+
config_enforcing = False
302304
except (IOError,OSError),e:
303305
if e.errno == 2: pass
304306
else: raise CheckFailed("An unknown error (%s) took place while checking for SELinux"%str(e))
305307
if enforcing:
306-
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.")
308+
raise CheckFailed('''SELinux is set to enforcing. There are two options:
309+
1> Set it permissive in /etc/selinux/config, then reboot the machine.
310+
2> Type 'setenforce Permissive' in commandline, after which you can run this program again.
311+
312+
We strongly suggest you doing the option 1 that makes sure SELinux goes into permissive after system reboot.\n''')
313+
314+
if config_enforcing:
315+
print "WARNING: We detected that your SELinux is not configured in permissive. to make sure cloudstack won't block by \
316+
SELinux after system reboot, we strongly suggest you setting it in permissive in /etc/selinux/config, then reboot the machine."
307317

308318

309319
def preflight_checks(do_check_kvm=True):

setup/bindir/cloud-setup-databases.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,7 @@ def checkselinux():
216216
try:
217217
check_selinux()
218218
except CheckFailed,e:
219-
sys.stderr.write("SELINUX is set to enforcing, please set it to permissive in /etc/selinux/config\n")
220-
sys.stderr.write("then reboot the machine, after which you can run this program again.\n")
219+
sys.stderr.write(e.__str__())
221220
sys.exit(3)
222221

223222
def checknetwork():

0 commit comments

Comments
 (0)