Example #1
0
def sysprep_params(session):
    """Collect the needed sysprep parameters"""
    d = session['dialog']
    image = session['image']

    default = None
    while 1:
        choices = []
        for name, param in image.os.sysprep_params.items():

            # Don't show the hidden parameters
            if param.hidden:
                continue

            value = "|".join([str(i) for i in param.value]) if param.is_list \
                else str(param.value)
            if len(value) == 0:
                value = "<not_set>"
            choices.append((name, value))

        if len(choices) == 0:
            d.msgbox("No customization parameters available", width=WIDTH)
            return True

        if default is None:
            default = choices[0][0]

        (code, choice) = d.menu(
            "In this menu you can see and update the value for parameters "
            "used in the system preparation tasks. Press <Details> to see "
            "more info about a specific configuration parameters and <Update> "
            "to update its value. Press <Back> when done.",
            height=18,
            width=WIDTH,
            choices=choices,
            menu_height=10,
            ok_label="Details",
            extra_button=1,
            extra_label="Update",
            cancel="Back",
            default_item=default,
            title="System Preparation Parameters")

        default = choice

        if code in (d.CANCEL, d.ESC):
            return True
        elif code == d.OK:  # Details button
            d.msgbox(image.os.sysprep_params[choice].description, width=WIDTH)
        else:  # Update button
            update_sysprep_param(session, choice)

    return True
Example #2
0
def sysprep_params(session):
    """Collect the needed sysprep parameters"""
    d = session['dialog']
    image = session['image']

    default = None
    while 1:
        choices = []
        for name, param in image.os.sysprep_params.items():

            # Don't show the hidden parameters
            if param.hidden:
                continue

            value = "|".join([str(i) for i in param.value]) if param.is_list \
                else str(param.value)
            if len(value) == 0:
                value = "<not_set>"
            choices.append((name, value))

        if len(choices) == 0:
            d.msgbox("No customization parameters available", width=WIDTH)
            return True

        if default is None:
            default = choices[0][0]

        (code, choice) = d.menu(
            "In this menu you can see and update the value for parameters "
            "used in the system preparation tasks. Press <Details> to see "
            "more info about a specific configuration parameters and <Update> "
            "to update its value. Press <Back> when done.", height=18,
            width=WIDTH, choices=choices, menu_height=10, ok_label="Details",
            extra_button=1, extra_label="Update", cancel="Back",
            default_item=default, title="System Preparation Parameters")

        default = choice

        if code in (d.CANCEL, d.ESC):
            return True
        elif code == d.OK:  # Details button
            d.msgbox(image.os.sysprep_params[choice].description, width=WIDTH)
        else:  # Update button
            update_sysprep_param(session, choice)

    return True
Example #3
0
def virtio(session):
    """Display the state of the VirtIO drivers in the media"""

    d = session['dialog']
    image = session['image']

    assert hasattr(image.os, 'virtio_state')
    assert hasattr(image.os, 'install_virtio_drivers')

    default_item = image.os.virtio_state.keys()[0]
    while 1:
        choices = []
        for name, details in virtio_versions(image.os.virtio_state).items():
            choices.append((name, details))

        (code, choice) = d.menu(
            "In this menu you can see details about the installed VirtIO "
            "drivers on the input media. Press <Info> to see more information "
            "about a specific installed driver or <Update> to install one or "
            "more new drivers.", height=16, width=WIDTH, choices=choices,
            ok_label="Info", menu_height=len(choices), cancel="Back",
            title="VirtIO Drivers", extra_button=1, extra_label="Update",
            default_item=default_item)

        if code in (d.CANCEL, d.ESC):
            return True
        elif code == d.OK:
            default_item = choice

            # Create a string with the driver details and display it.
            details = ""
            for fname, driver in image.os.virtio_state[choice].items():
                details += "%s\n%s\n" % (fname, "=" * len(fname))
                name = ""
                if 'DriverPackageDisplayName' in driver:
                    name = driver['DriverPackageDisplayName']
                provider = ""
                if 'Provider' in driver:
                    provider = driver['Provider']
                date = ""
                version = ""
                if 'DriverVer' in driver:
                    version = driver['DriverVer'].split(',', 1)
                    date = version[0].strip()
                    version = version[1] if len(version) > 1 else ""
                    try:
                        date = time.strptime(
                            date, "%m/%d/%y").strftime('%d/%m/%Y', date)
                    except ValueError:
                        pass
                dtype = ""
                if 'DriverPackageType' in driver:
                    dtype = driver['DriverPackageType']
                dclass = ""
                if 'Class' in driver:
                    dclass = driver['Class']

                details += "Name:      %s\n" % name.strip('\'"')
                details += "Provider:  %s\n" % provider.strip('\'"')
                details += "Date:      %s\n" % date
                details += "Version:   %s\n" % version
                details += "Type:      %s\n" % dtype
                details += "Class:     %s\n\n" % dclass

            if len(details):
                d.scrollbox(details, width=WIDTH)
        else:  # Update button
            title = "Please select a directory that hosts VirtIO drivers."
            if not update_sysprep_param(session, "virtio", title=title):
                continue
            install_virtio_drivers(session)

    return True
Example #4
0
def virtio(session):
    """Display the state of the VirtIO drivers in the media"""

    d = session['dialog']
    image = session['image']

    assert hasattr(image.os, 'virtio_state')
    assert hasattr(image.os, 'install_virtio_drivers')

    default_item = image.os.virtio_state.keys()[0]
    while 1:
        choices = []
        for name, details in virtio_versions(image.os.virtio_state).items():
            choices.append((name, details))

        (code, choice) = d.menu(
            "In this menu you can see details about the installed VirtIO "
            "drivers on the input media. Press <Info> to see more information "
            "about a specific installed driver or <Update> to install one or "
            "more new drivers.",
            height=16,
            width=WIDTH,
            choices=choices,
            ok_label="Info",
            menu_height=len(choices),
            cancel="Back",
            title="VirtIO Drivers",
            extra_button=1,
            extra_label="Update",
            default_item=default_item)

        if code in (d.CANCEL, d.ESC):
            return True
        elif code == d.OK:
            default_item = choice

            # Create a string with the driver details and display it.
            details = ""
            for fname, driver in image.os.virtio_state[choice].items():
                details += "%s\n%s\n" % (fname, "=" * len(fname))
                name = ""
                if 'DriverPackageDisplayName' in driver:
                    name = driver['DriverPackageDisplayName']
                provider = ""
                if 'Provider' in driver:
                    provider = driver['Provider']
                date = ""
                version = ""
                if 'DriverVer' in driver:
                    version = driver['DriverVer'].split(',', 1)
                    date = version[0].strip()
                    version = version[1] if len(version) > 1 else ""
                    try:
                        date = time.strptime(date, "%m/%d/%y").strftime(
                            '%d/%m/%Y', date)
                    except ValueError:
                        pass
                dtype = ""
                if 'DriverPackageType' in driver:
                    dtype = driver['DriverPackageType']
                dclass = ""
                if 'Class' in driver:
                    dclass = driver['Class']

                details += "Name:      %s\n" % name.strip('\'"')
                details += "Provider:  %s\n" % provider.strip('\'"')
                details += "Date:      %s\n" % date
                details += "Version:   %s\n" % version
                details += "Type:      %s\n" % dtype
                details += "Class:     %s\n\n" % dclass

            if len(details):
                d.scrollbox(details, width=WIDTH)
        else:  # Update button
            title = "Please select a directory that hosts VirtIO drivers."
            if not update_sysprep_param(session, "virtio", title=title):
                continue
            install_virtio_drivers(session)

    return True
Example #5
0
 def virtio_extra():
     if not session['image'].os.sysprep_params['virtio'].value:
         title = "Please select a directory that hosts VirtIO drivers."
         update_sysprep_param(session, 'virtio', title=title)
     else:
         session['image'].os.sysprep_params['virtio'].value = ""
 def virtio_extra():
     if not session['image'].os.sysprep_params['virtio'].value:
         title = "Please select a directory that hosts VirtIO drivers."
         update_sysprep_param(session, 'virtio', title=title)
     else:
         session['image'].os.sysprep_params['virtio'].value = ""