Change in vdsm[master]: tool: sebool when selinux is disabled always return CONFIGURED.

mtayer at redhat.com mtayer at redhat.com
Mon Oct 27 16:42:16 UTC 2014


mooli tayer has uploaded a new change for review.

Change subject: tool: sebool when selinux is disabled always return CONFIGURED.
......................................................................

tool: sebool when selinux is disabled always return CONFIGURED.

Otherwise if selinux is disabled, we get an exception[1]

[1]:
>>> sebool_obj = seobject.booleanRecords()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/seobject.py", line 2032, in __init__
    semanageRecords.__init__(self, store)
  File "/usr/lib64/python2.6/site-packages/seobject.py", line 240, in __init__
    self.sh = self.get_handle(store)
  File "/usr/lib64/python2.6/site-packages/seobject.py", line 267, in get_handle
    raise ValueError(_("SELinux policy is not managed or store cannot be accessed."))
ValueError: SELinux policy is not managed or store cannot be accessed.

Change-Id: I8d728fac39be454600235d80c8c24641d6c309a4
Signed-off-by: Mooli Tayer <mtayer at redhat.com>
---
M lib/vdsm/tool/configurators/sebool.py
1 file changed, 7 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/16/34516/1

diff --git a/lib/vdsm/tool/configurators/sebool.py b/lib/vdsm/tool/configurators/sebool.py
index 654d7c7..481e091 100644
--- a/lib/vdsm/tool/configurators/sebool.py
+++ b/lib/vdsm/tool/configurators/sebool.py
@@ -69,15 +69,16 @@
         """
         True all selinux booleans in the list above are set properly
         """
-        import seobject
         ret = CONFIGURED
+        if utils.get_selinux_enforce_mode() > -1:
+            import seobject
 
-        sebool_obj = seobject.booleanRecords()
-        sebool_status = sebool_obj.get_all()
+            sebool_obj = seobject.booleanRecords()
+            sebool_status = sebool_obj.get_all()
 
-        for sebool_variable in VDSM_SEBOOL_LIST:
-            if not all(sebool_status[sebool_variable]):
-                ret = NOT_CONFIGURED
+            for sebool_variable in VDSM_SEBOOL_LIST:
+                if not all(sebool_status[sebool_variable]):
+                    ret = NOT_CONFIGURED
 
         return ret
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8d728fac39be454600235d80c8c24641d6c309a4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: mooli tayer <mtayer at redhat.com>


More information about the vdsm-patches mailing list