Revision fa65eda1 image_creator/dialog_menu.py
b/image_creator/dialog_menu.py | ||
---|---|---|
504 | 504 |
help_title = "System Preperation Tasks" |
505 | 505 |
sysprep_help = "%s\n%s\n\n" % (help_title, '=' * len(help_title)) |
506 | 506 |
|
507 |
if 'exec_syspreps' not in session: |
|
508 |
session['exec_syspreps'] = [] |
|
509 | 507 |
|
510 |
all_syspreps = image.os.list_syspreps() |
|
511 |
# Only give the user the choice between syspreps that have not ran yet |
|
512 |
syspreps = [s for s in all_syspreps if s not in session['exec_syspreps']] |
|
508 |
syspreps = image.os.list_syspreps() |
|
513 | 509 |
|
514 | 510 |
if len(syspreps) == 0: |
515 | 511 |
d.msgbox("No system preparation task available to run!", |
... | ... | |
544 | 540 |
for i in range(len(syspreps)): |
545 | 541 |
if str(i + 1) in tags: |
546 | 542 |
image.os.enable_sysprep(syspreps[i]) |
547 |
session['exec_syspreps'].append(syspreps[i]) |
|
548 | 543 |
else: |
549 | 544 |
image.os.disable_sysprep(syspreps[i]) |
550 | 545 |
|
546 |
if len([s for s in image.os.list_syspreps() if s.enabled]) == 0: |
|
547 |
d.msgbox("No system preperation task is selected!", |
|
548 |
title="System Preperation", width=SMALL_WIDTH) |
|
549 |
continue |
|
550 |
|
|
551 | 551 |
infobox = InfoBoxOutput(d, "Image Configuration") |
552 | 552 |
try: |
553 | 553 |
image.out.add(infobox) |
554 | 554 |
try: |
555 | 555 |
image.mount(readonly=False) |
556 | 556 |
try: |
557 |
err_msg = \
|
|
558 |
"Unable to execute the system preparation tasks."
|
|
557 |
err = "Unable to execute the system preparation " \
|
|
558 |
"tasks. Couldn't mount the media%s."
|
|
559 | 559 |
if not image.mounted: |
560 |
d.msgbox( |
|
561 |
"%s Couldn't mount the media." % err_msg, |
|
562 |
title="System Preperation", width=SMALL_WIDTH) |
|
560 |
d.msgbox(err % "", title="System Preperation", |
|
561 |
width=SMALL_WIDTH) |
|
563 | 562 |
return |
564 | 563 |
elif image.mounted_ro: |
565 | 564 |
d.msgbox( |
566 |
"%s Couldn't mount the media read-write."
|
|
567 |
% err_msg, title="System Preperation",
|
|
568 |
width=SMALL_WIDTH)
|
|
565 |
err % " read-write",title="System Preperation",
|
|
566 |
width=SMALL_WIDTH
|
|
567 |
) |
|
569 | 568 |
return |
570 | 569 |
|
571 | 570 |
# The checksum is invalid. We have mounted the image rw |
... | ... | |
577 | 576 |
image.os.do_sysprep() |
578 | 577 |
infobox.finalize() |
579 | 578 |
|
580 |
# Disable syspreps that have ran |
|
581 |
for sysprep in session['exec_syspreps']: |
|
582 |
image.os.disable_sysprep(sysprep) |
|
583 | 579 |
finally: |
584 | 580 |
image.umount() |
585 | 581 |
finally: |
Also available in: Unified diff