[node-patches] Change in ovirt-node[master]: security: Move Selinux stuff into function

fabiand at redhat.com fabiand at redhat.com
Fri Sep 12 13:45:36 UTC 2014


Fabian Deutsch has uploaded a new change for review.

Change subject: security: Move Selinux stuff into function
......................................................................

security: Move Selinux stuff into function

Selinux relabeling is moved into a function to prevent circular imports.

Change-Id: I98690e612a3e299ec2a8b4641a214062f2dea059
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/utils/fs/__init__.py
1 file changed, 10 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/63/32863/1

diff --git a/src/ovirt/node/utils/fs/__init__.py b/src/ovirt/node/utils/fs/__init__.py
index 9160d86..7bba878 100644
--- a/src/ovirt/node/utils/fs/__init__.py
+++ b/src/ovirt/node/utils/fs/__init__.py
@@ -84,6 +84,15 @@
         pass
 
 
+def restorecon(path):
+    """Restore the context of the given path
+
+    Import is inside the function to address circular imports
+    """
+    from ...utils import selinux
+    security.Selinux().restorecon(path)
+
+
 class File(base.Base):
     """Convenience API to access files.
     Used to make code testable
@@ -416,7 +425,7 @@
                 self._logger.error('Failed to persist "%s"', path)
                 return -1
 
-            utils.security.Selinux().restorecon(abspath)
+            restorecon(abspath)
 
     def _persist_dir(self, abspath):
         """Persist directory and bind mount it back to its current location


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I98690e612a3e299ec2a8b4641a214062f2dea059
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at redhat.com>



More information about the node-patches mailing list