def os_cls(distro, osfamily):
+ """Given the distro name and the osfamily, return the appropriate class"""
module = None
classname = None
try:
def sysprep(enabled=True):
+ """Decorator for system preparation tasks"""
def wrapper(func):
func.sysprep = True
func.enabled = enabled
+ func.executed = False
return func
return wrapper
self.meta['ROOT_PARTITION'] = "%d" % self.g.part_to_partnum(self.root)
self.meta['OSFAMILY'] = self.g.inspect_get_type(self.root)
self.meta['OS'] = self.g.inspect_get_distro(self.root)
+ if self.meta['OS'] == "unknown":
+ self.meta['OS'] = self.meta['OSFAMILY']
self.meta['DESCRIPTION'] = self.g.inspect_get_product_name(self.root)
def _is_sysprep(self, obj):
objs = [getattr(self, name) for name in dir(self)
if not name.startswith('_')]
- return [x for x in objs if self._is_sysprep(x)]
+ return [x for x in objs if self._is_sysprep(x) and x.executed is False]
def sysprep_info(self, obj):
assert self._is_sysprep(obj), "Object is not a sysprep"
cnt += 1
self.out.output(('(%d/%d)' % (cnt, size)).ljust(7), False)
task()
+ setattr(task.im_func, 'executed', True)
self.out.output()
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :