Преглед изворни кода

Merge pull request #61 from gabriel-samfira/add-selinux-setfiles

Add _set_selinux_autorelabel()
Nashwan Azhari пре 6 година
родитељ
комит
cc737e1207
2 измењених фајлова са 8 додато и 2 уклоњено
  1. 8 0
      coriolis/osmorphing/base.py
  2. 0 2
      coriolis/osmorphing/redhat.py

+ 8 - 0
coriolis/osmorphing/base.py

@@ -211,3 +211,11 @@ class BaseLinuxOSMorphingTools(BaseOSMorphingTools):
                 "mv -f /%s /%s.bak" % (fstab_chroot_path, fstab_chroot_path))
                 "mv -f /%s /%s.bak" % (fstab_chroot_path, fstab_chroot_path))
             self._write_file(
             self._write_file(
                 fstab_chroot_path, "\n".join(fstab_contents_lines))
                 fstab_chroot_path, "\n".join(fstab_contents_lines))
+
+    def _set_selinux_autorelabel(self):
+        LOG.debug("setting autorelabel on /")
+        try:
+            self._exec_cmd_chroot(
+                "touch /.autorelabel")
+        except Exception as err:
+            LOG.warning("Failed to set autorelabel: %r" % err)

+ 0 - 2
coriolis/osmorphing/redhat.py

@@ -216,5 +216,3 @@ class BaseRedHatMorphingTools(base.BaseLinuxOSMorphingTools):
         return [os.path.join(self._NETWORK_SCRIPTS_PATH, f) for f in
         return [os.path.join(self._NETWORK_SCRIPTS_PATH, f) for f in
                 dir_content if re.match("^ifcfg-(.*)", f)]
                 dir_content if re.match("^ifcfg-(.*)", f)]
 
 
-    def _set_selinux_autorelabel(self):
-        self._exec_cmd_chroot("touch /.autorelabel")