Remove backup file for shadow
[snf-image-creator] / image_creator / os_type / linux.py
index ada6ab4..53e8a5a 100644 (file)
@@ -116,6 +116,9 @@ class Linux(Unix):
 
         self.image.g.write('/etc/shadow', "\n".join(shadow) + '\n')
 
+        # Remove backup file for /etc/shadow
+        self.image.g.rm_rf('/etc/shadow-')
+
     @sysprep('Fixing acpid powerdown action')
     def fix_acpid(self):
         """Replace acpid powerdown action scripts to immediately shutdown the
@@ -155,9 +158,9 @@ class Linux(Unix):
                         self.out.warn("Acpid action file: %s does not exist" %
                                       action)
                         return
-                    self.image.g.copy_file_to_file(action,
-                                             "%s.orig.snf-image-creator-%d" %
-                                             (action, time.time()))
+                    self.image.g.copy_file_to_file(
+                        action, "%s.orig.snf-image-creator-%d" %
+                        (action, time.time()))
                     self.image.g.write(action, powerbtn_action)
                     return
                 else:
@@ -298,6 +301,20 @@ class Linux(Unix):
 
         return orig, dev, mpoint
 
+    def _do_inspect(self):
+        """Run various diagnostics to check if media is supported"""
+
+        self.out.output(
+            'Checking if the media contains logical volumes (LVM)...', False)
+
+        has_lvm = True if len(self.image.g.lvs()) else False
+
+        if has_lvm:
+            self.out.output()
+            self.image.set_unsupported('The media contains logical volumes')
+        else:
+            self.out.success('no')
+
     def _do_collect_metadata(self):
         """Collect metadata about the OS"""
         super(Linux, self)._do_collect_metadata()