Revision d415dda2 image_creator/dialog_menu.py

b/image_creator/dialog_menu.py
615 615
    return True
616 616

  
617 617

  
618
def sysprep_params(session):
619

  
620
    d = session['dialog']
621
    image = session['image']
622

  
623
    available = image.os.sysprep_params
624
    needed = image.os.needed_sysprep_params()
625

  
626
    if len(needed) == 0:
627
        return True
628

  
629
    fields = []
630
    for param in needed:
631
        default = available[param.name] if param.name in available else ""
632
        fields.append(("%s: " % param.description, default, param.length))
633

  
634
    txt = "Please provide the following system preparation parameters:"
635
    code, output = d.form(txt, height=13, width=WIDTH, form_height=len(fields),
636
                          fields=fields)
637

  
638
    if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
639
        return False
640

  
641
    sysprep_params = {}
642
    for i in range(len(fields)):
643
        if needed[i].validator(output[i]):
644
            image.os.sysprep_params[needed[i].name] = output[i]
645
        else:
646
            d.msgbox("The value you provided for parameter: %s is not valid" %
647
                     name, width=SMALL_WIDTH)
648
            return False
649

  
650
    return True
651

  
652

  
618 653
def sysprep(session):
619 654
    """Perform various system preperation tasks on the image"""
620 655
    d = session['dialog']
......
677 712
                         title="System Preperation", width=SMALL_WIDTH)
678 713
                continue
679 714

  
715
            if not sysprep_params(session):
716
                continue
717

  
680 718
            infobox = InfoBoxOutput(d, "Image Configuration")
681 719
            try:
682 720
                image.out.add(infobox)

Also available in: Unified diff