Syspreps that have already been executed shouldn't get returned by
list_syspreps
help_title = "System Preperation Tasks"
sysprep_help = "%s\n%s\n\n" % (help_title, '=' * len(help_title))
help_title = "System Preperation Tasks"
sysprep_help = "%s\n%s\n\n" % (help_title, '=' * len(help_title))
- if 'exec_syspreps' not in session:
- session['exec_syspreps'] = []
- all_syspreps = image.os.list_syspreps()
- # Only give the user the choice between syspreps that have not ran yet
- syspreps = [s for s in all_syspreps if s not in session['exec_syspreps']]
+ syspreps = image.os.list_syspreps()
if len(syspreps) == 0:
d.msgbox("No system preparation task available to run!",
if len(syspreps) == 0:
d.msgbox("No system preparation task available to run!",
for i in range(len(syspreps)):
if str(i + 1) in tags:
image.os.enable_sysprep(syspreps[i])
for i in range(len(syspreps)):
if str(i + 1) in tags:
image.os.enable_sysprep(syspreps[i])
- session['exec_syspreps'].append(syspreps[i])
else:
image.os.disable_sysprep(syspreps[i])
else:
image.os.disable_sysprep(syspreps[i])
+ if len([s for s in image.os.list_syspreps() if s.enabled]) == 0:
+ d.msgbox("No system preperation task is selected!",
+ title="System Preperation", width=SMALL_WIDTH)
+ continue
+
infobox = InfoBoxOutput(d, "Image Configuration")
try:
image.out.add(infobox)
try:
image.mount(readonly=False)
try:
infobox = InfoBoxOutput(d, "Image Configuration")
try:
image.out.add(infobox)
try:
image.mount(readonly=False)
try:
- err_msg = \
- "Unable to execute the system preparation tasks."
+ err = "Unable to execute the system preparation " \
+ "tasks. Couldn't mount the media%s."
- d.msgbox(
- "%s Couldn't mount the media." % err_msg,
- title="System Preperation", width=SMALL_WIDTH)
+ d.msgbox(err % "", title="System Preperation",
+ width=SMALL_WIDTH)
return
elif image.mounted_ro:
d.msgbox(
return
elif image.mounted_ro:
d.msgbox(
- "%s Couldn't mount the media read-write."
- % err_msg, title="System Preperation",
- width=SMALL_WIDTH)
+ err % " read-write",title="System Preperation",
+ width=SMALL_WIDTH
+ )
return
# The checksum is invalid. We have mounted the image rw
return
# The checksum is invalid. We have mounted the image rw
image.os.do_sysprep()
infobox.finalize()
image.os.do_sysprep()
infobox.finalize()
- # Disable syspreps that have ran
- for sysprep in session['exec_syspreps']:
- image.os.disable_sysprep(sysprep)
finally:
image.umount()
finally:
finally:
image.umount()
finally:
def wrapper(func):
func.sysprep = True
func.enabled = enabled
def wrapper(func):
func.sysprep = True
func.enabled = enabled
return func
return wrapper
return func
return wrapper
objs = [getattr(self, name) for name in dir(self)
if not name.startswith('_')]
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"
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()
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 :
self.out.output()
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :