Merge branch 'hotfix-0.4.4' into develop
[snf-image-creator] / image_creator / os_type / __init__.py
index 6cecbb9..cc7d39a 100644 (file)
@@ -62,6 +62,7 @@ def os_cls(distro, osfamily):
 
 
 def add_prefix(target):
+    """Decorator that adds a prefix to the result of a function"""
     def wrapper(self, *args):
         prefix = args[0]
         return [prefix + path for path in target(self, *args)]
@@ -98,6 +99,8 @@ def add_sysprep_param(name, type, default, descr, validate=lambda x: True):
             init(self, *args, **kwargs)
             self.needed_sysprep_params[name] = \
                 self.SysprepParam(type, default, descr, validate)
+            if default is not None:
+                self.sysprep_params[name] = default
         return inner
     return wrapper
 
@@ -135,6 +138,13 @@ class OSBase(object):
         self.meta = {}
         self.mounted = False
 
+        # Many guestfs compilations don't support scrub
+        self._scrub_support = True
+        try:
+            self.g.available(['scrub'])
+        except RuntimeError:
+            self._scrub_support = False
+
     def collect_metadata(self):
         """Collect metadata about the OS"""
         try: