Use libselinux-python instead of subprocess

This commit is contained in:
Luke Macken 2015-06-05 10:19:39 -04:00
parent 37b7a23505
commit 4e8e1d4d90
2 changed files with 6 additions and 10 deletions

View File

@ -16,7 +16,7 @@ import os
import pungi.gather
import pungi.config
import pungi.ks
import subprocess
import selinux
def main():
@ -30,15 +30,10 @@ def main():
return 1
if opts.do_all or opts.do_buildinstall:
try:
selinux = subprocess.Popen('/usr/sbin/getenforce',
stdout=subprocess.PIPE,
stderr=open('/dev/null', 'w')).communicate()[0].strip('\n')
if selinux == 'Enforcing':
print >> sys.stdout, "WARNING: SELinux is enforcing. This may lead to a compose with selinux disabled."
print >> sys.stdout, "Consider running with setenforce 0."
except:
pass
enforcing = selinux.security_getenforce()
if enforcing:
print >> sys.stdout, "WARNING: SELinux is enforcing. This may lead to a compose with selinux disabled."
print >> sys.stdout, "Consider running with setenforce 0."
# Set up the kickstart parser and pass in the kickstart file we were handed
ksparser = pungi.ks.get_ksparser(ks_path=opts.config)

View File

@ -15,6 +15,7 @@ Requires: python-lockfile
Requires: kobo
Requires: python-productmd
Requires: python-kickstart
Requires: libselinux-python
BuildArch: noarch