mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-11 00:31:56 -06:00
Don't run restorecon if SELinux is disabled or not present.
Also check for the existence of restorecon. This may be overkill but it will prevent a client installation from failing for no good reason. https://fedorahosted.org/freeipa/ticket/2368
This commit is contained in:
parent
306bdccfa4
commit
e9ed7f7ca1
@ -140,7 +140,18 @@ def restore_context(filepath):
|
||||
|
||||
ipautil.run() will do the logging.
|
||||
"""
|
||||
ipautil.run(["/sbin/restorecon", filepath], raiseonerr=False)
|
||||
try:
|
||||
if (os.path.exists('/usr/sbin/selinuxenabled')):
|
||||
ipautil.run(["/usr/sbin/selinuxenabled"])
|
||||
else:
|
||||
# No selinuxenabled, no SELinux
|
||||
return
|
||||
except ipautil.CalledProcessError:
|
||||
# selinuxenabled returns 1 if not enabled
|
||||
return
|
||||
|
||||
if (os.path.exists('/sbin/restorecon')):
|
||||
ipautil.run(["/sbin/restorecon", filepath], raiseonerr=False)
|
||||
|
||||
def backup_and_replace_hostname(fstore, statestore, hostname):
|
||||
old_hostname = socket.gethostname()
|
||||
|
Loading…
Reference in New Issue
Block a user