Merge branch 'hotfix-0.4.4' into develop
[snf-image-creator] / image_creator / os_type / unix.py
index 504f2ad..7e3ba22 100644 (file)
@@ -121,12 +121,18 @@ class Unix(OSBase):
         if self.g.is_dir('/home/'):
             homedirs += self._ls('/home/')
 
+        action = self.g.rm_rf
+        if self._scrub_support:
+            action = self.g.scrub_file
+        else:
+            self.out.warn("Sensitive data won't be scrubbed (not supported)")
+
         for homedir in homedirs:
             for data in self.sensitive_userdata:
                 fname = "%s/%s" % (homedir, data)
                 if self.g.is_file(fname):
-                    self.g.scrub_file(fname)
+                    action(fname)
                 elif self.g.is_dir(fname):
-                    self._foreach_file(fname, self.g.scrub_file, ftype='r')
+                    self._foreach_file(fname, action, ftype='r')
 
 # vim: set sta sts=4 shiftwidth=4 sw=4 et ai :