Fix a typo in the restorecon method, and import the stat module.
This commit is contained in:
parent
f4a6eb5feb
commit
8222e32ca0
@ -164,7 +164,7 @@ diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinuxswig_python.i libs
|
|||||||
|
|
||||||
+%pythoncode %{
|
+%pythoncode %{
|
||||||
+
|
+
|
||||||
+import shutil, os
|
+import shutil, os, stat
|
||||||
+
|
+
|
||||||
+def restorecon(path, recursive=False):
|
+def restorecon(path, recursive=False):
|
||||||
+ """ Restore SELinux context on a given path """
|
+ """ Restore SELinux context on a given path """
|
||||||
@ -175,7 +175,7 @@ diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinuxswig_python.i libs
|
|||||||
+ if recursive:
|
+ if recursive:
|
||||||
+ os.path.walk(path, lambda arg, dirname, fnames:
|
+ os.path.walk(path, lambda arg, dirname, fnames:
|
||||||
+ map(restorecon, [os.path.join(dirname, fname)
|
+ map(restorecon, [os.path.join(dirname, fname)
|
||||||
+ s for fname in fnames]), None)
|
+ for fname in fnames]), None)
|
||||||
+
|
+
|
||||||
+def copytree(src, dest):
|
+def copytree(src, dest):
|
||||||
+ """ An SELinux-friendly shutil.copytree method """
|
+ """ An SELinux-friendly shutil.copytree method """
|
||||||
|
Loading…
Reference in New Issue
Block a user