Change in vdsm[master]: seboolsetup: catch RuntimeError expection

dougsland at redhat.com dougsland at redhat.com
Thu Jan 10 19:40:04 UTC 2013


Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: seboolsetup: catch RuntimeError expection
......................................................................

seboolsetup: catch RuntimeError expection

if selinux is disabled do not trow RuntimeError trying to use
selinux module.

Change-Id: I538b028259f81a792eab88e9a281cbd81aad0312
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=893065
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M vdsm-tool/seboolsetup.py
1 file changed, 12 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/10892/1

diff --git a/vdsm-tool/seboolsetup.py b/vdsm-tool/seboolsetup.py
index 437da68..482fa6e 100644
--- a/vdsm-tool/seboolsetup.py
+++ b/vdsm-tool/seboolsetup.py
@@ -18,7 +18,7 @@
 # Refer to the README and COPYING files for full details of the license
 #
 
-import seobject
+import selinux
 from vdsm.tool import expose
 
 SEBOOL_ENABLED = "on"
@@ -36,6 +36,7 @@
 
 
 def setup_booleans(status):
+    import seobject
     sebool_obj = seobject.booleanRecords()
     sebool_status = sebool_obj.get_all()
 
@@ -54,10 +55,18 @@
 @expose("sebool-config")
 def sebool_config():
     """Enable the required selinux booleans"""
-    setup_booleans(True)
+    try:
+        setup_booleans(True)
+    except RuntimeError, e:
+        if selinux.is_selinux_enabled() == 1:
+            raise e
 
 
 @expose("sebool-unconfig")
 def sebool_unconfig():
     """Disable the required selinux booleans"""
-    setup_booleans(False)
+    try:
+        setup_booleans(False)
+    except RuntimeError, e:
+        if selinux.is_selinux_enabled() == 1:
+            raise e


--
To view, visit http://gerrit.ovirt.org/10892
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I538b028259f81a792eab88e9a281cbd81aad0312
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>


More information about the vdsm-patches mailing list