Use libselinux-python instead of subprocess
This commit is contained in:
parent
37b7a23505
commit
4e8e1d4d90
15
bin/pungi
15
bin/pungi
@ -16,7 +16,7 @@ import os
|
|||||||
import pungi.gather
|
import pungi.gather
|
||||||
import pungi.config
|
import pungi.config
|
||||||
import pungi.ks
|
import pungi.ks
|
||||||
import subprocess
|
import selinux
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
@ -30,15 +30,10 @@ def main():
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
if opts.do_all or opts.do_buildinstall:
|
if opts.do_all or opts.do_buildinstall:
|
||||||
try:
|
enforcing = selinux.security_getenforce()
|
||||||
selinux = subprocess.Popen('/usr/sbin/getenforce',
|
if enforcing:
|
||||||
stdout=subprocess.PIPE,
|
print >> sys.stdout, "WARNING: SELinux is enforcing. This may lead to a compose with selinux disabled."
|
||||||
stderr=open('/dev/null', 'w')).communicate()[0].strip('\n')
|
print >> sys.stdout, "Consider running with setenforce 0."
|
||||||
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
|
|
||||||
|
|
||||||
# Set up the kickstart parser and pass in the kickstart file we were handed
|
# Set up the kickstart parser and pass in the kickstart file we were handed
|
||||||
ksparser = pungi.ks.get_ksparser(ks_path=opts.config)
|
ksparser = pungi.ks.get_ksparser(ks_path=opts.config)
|
||||||
|
@ -15,6 +15,7 @@ Requires: python-lockfile
|
|||||||
Requires: kobo
|
Requires: kobo
|
||||||
Requires: python-productmd
|
Requires: python-productmd
|
||||||
Requires: python-kickstart
|
Requires: python-kickstart
|
||||||
|
Requires: libselinux-python
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user