diff --git a/lecm/utils.py b/lecm/utils.py index c51568e..eac2ef2 100644 --- a/lecm/utils.py +++ b/lecm/utils.py @@ -19,7 +19,6 @@ import copy import logging import os -import platform import subprocess LOG = logging.getLogger(__name__) @@ -46,23 +45,22 @@ def filter_certificates(items, certificates): def enforce_selinux_context(output_directory): - if platform.dist()[0] in ['fedora', 'centos', 'redhat']: - if os.path.exists('/sbin/semanage'): - FNULL = open(os.devnull, 'w') - - # Set new selinux so it is persistent over reboot - command = 'semanage fcontext -a -t cert_t %s(/.*?)' % ( - output_directory - ) - p = subprocess.Popen(command.split(), stdout=FNULL, - stderr=subprocess.STDOUT) - p.wait() - - # Ensure file have the right context applied - command = 'restorecon -Rv %s' % output_directory - p = subprocess.Popen(command.split(), stdout=FNULL, - stderr=subprocess.STDOUT) - p.wait() + if os.path.exists('/sbin/semanage'): + FNULL = open(os.devnull, 'w') + + # Set new selinux so it is persistent over reboot + command = 'semanage fcontext -a -t cert_t %s(/.*?)' % ( + output_directory + ) + p = subprocess.Popen(command.split(), stdout=FNULL, + stderr=subprocess.STDOUT) + p.wait() + + # Ensure file have the right context applied + command = 'restorecon -Rv %s' % output_directory + p = subprocess.Popen(command.split(), stdout=FNULL, + stderr=subprocess.STDOUT) + p.wait() def reload_service(service_name, service_provider):