summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorRishabh Dave <rishabhddave@gmail.com>2017-10-15 18:41:10 +0530
committerAmar Tumballi <amarts@redhat.com>2017-10-31 07:54:26 +0000
commitf4805ca6cf67d1d8394b14f21eceb2d9592ba228 (patch)
tree379a43d84a27d80d8abd2237fdf67df4070fe430 /extras
parentc0e77f643930499966554cd849a40580e4ff68f9 (diff)
snapshot/scheduler: handle the exception when SELinux is absent
When SELinux is absent on an given system, snapshot_scheduler.py raises an exception; handle it and report it in the log. Change-Id: I21bc179e090d34f8061063e6d662521ee5046cce BUG: 1502253 Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
Diffstat (limited to 'extras')
-rwxr-xr-xextras/snap_scheduler/snap_scheduler.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/extras/snap_scheduler/snap_scheduler.py b/extras/snap_scheduler/snap_scheduler.py
index 61d1c514a9a..c6600a4a3d7 100755
--- a/extras/snap_scheduler/snap_scheduler.py
+++ b/extras/snap_scheduler/snap_scheduler.py
@@ -575,8 +575,13 @@ def get_selinux_status():
getenforce_cli = ["getenforce"]
log.debug("Running command '%s'", " ".join(getenforce_cli))
- p1 = subprocess.Popen(getenforce_cli, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ try:
+ p1 = subprocess.Popen(getenforce_cli, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ except OSError as oserr:
+ log.error("Failed to run the command \"getenforce\". Error: %s" %\
+ oserr)
+ return -1
output, err = p1.communicate()
rv = p1.returncode