Exemple #1
0
def show_properties_help(session):
    """Show help for image properties"""
    d = session['dialog']

    help_file = get_help_file("image_properties")
    assert os.path.exists(help_file)
    d.textbox(help_file, title="Image Properties", width=78, height=40)
Exemple #2
0
def show_properties_help(session):
    """Show help for image properties"""
    d = session['dialog']

    help_file = get_help_file("image_properties")
    assert os.path.exists(help_file)
    d.textbox(help_file, title="Image Properties", width=78, height=40)
Exemple #3
0
def exclude_tasks(session):
    """Exclude specific tasks from running during image deployment"""
    d = session['dialog']
    image = session['image']

    if image.is_unsupported():
        d.msgbox("Image deployment configuration is disabled for unsupported "
                 "images.", width=SMALL_WIDTH)
        return False

    index = 0
    displayed_index = 1
    choices = []
    mapping = {}
    if 'excluded_tasks' not in session:
        session['excluded_tasks'] = []

    if -1 in session['excluded_tasks']:
        if d.yesno("Image deployment configuration is disabled. "
                   "Do you wish to enable it?", width=SMALL_WIDTH) == d.OK:
            session['excluded_tasks'].remove(-1)
        else:
            return False

    for (msg, task, os_check) in CONFIGURATION_TASKS:
        if os_check(image.meta['OSFAMILY']):
            checked = 1 if index in session['excluded_tasks'] else 0
            choices.append((str(displayed_index), msg, checked))
            mapping[displayed_index] = index
            displayed_index += 1
        index += 1

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

    while 1:
        text = "Please choose which configuration tasks you would like to " \
               "prevent from running during image deployment. " \
               "Press <No Config> to suppress any configuration. " \
               "Press <Help> for more help on the image deployment " \
               "configuration tasks."

        (code, tags) = d.checklist(
            text=text, choices=choices, height=19, list_height=8, width=WIDTH,
            help_button=1, extra_button=1, extra_label="No Config",
            title="Exclude Configuration Tasks")
        tags = [x.strip('"') for x in tags]  # Needed for OpenSUSE

        if code in (d.CANCEL, d.ESC):
            return False
        elif code == d.HELP:
            help_file = get_help_file("configuration_tasks")
            assert os.path.exists(help_file)
            d.textbox(help_file, title="Configuration Tasks",
                      width=70, height=40)
        # No Config button
        elif code == d.EXTRA:
            session['excluded_tasks'] = [-1]
            session['task_metadata'] = ["EXCLUDE_ALL_TASKS"]
            break
        elif code == d.OK:
            session['excluded_tasks'] = []
            for tag in tags:
                session['excluded_tasks'].append(mapping[int(tag)])

            exclude_metadata = []
            for task in session['excluded_tasks']:
                exclude_metadata.extend(CONFIGURATION_TASKS[task][1])

            session['task_metadata'] = ["EXCLUDE_TASK_%s" % x
                                        for x in exclude_metadata]
            break

    return True
Exemple #4
0
def exclude_tasks(session):
    """Exclude specific tasks from running during image deployment"""
    d = session['dialog']
    image = session['image']

    if image.is_unsupported():
        d.msgbox(
            "Image deployment configuration is disabled for unsupported "
            "images.",
            width=SMALL_WIDTH)
        return False

    index = 0
    displayed_index = 1
    choices = []
    mapping = {}
    if 'excluded_tasks' not in session:
        session['excluded_tasks'] = []

    if -1 in session['excluded_tasks']:
        if d.yesno(
                "Image deployment configuration is disabled. "
                "Do you wish to enable it?",
                width=SMALL_WIDTH) == d.OK:
            session['excluded_tasks'].remove(-1)
        else:
            return False

    for (msg, task, os_check) in CONFIGURATION_TASKS:
        if os_check(image.meta['OSFAMILY']):
            checked = 1 if index in session['excluded_tasks'] else 0
            choices.append((str(displayed_index), msg, checked))
            mapping[displayed_index] = index
            displayed_index += 1
        index += 1

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

    while 1:
        text = "Please choose which configuration tasks you would like to " \
               "prevent from running during image deployment. " \
               "Press <No Config> to suppress any configuration. " \
               "Press <Help> for more help on the image deployment " \
               "configuration tasks."

        (code, tags) = d.checklist(text=text,
                                   choices=choices,
                                   height=19,
                                   list_height=8,
                                   width=WIDTH,
                                   help_button=1,
                                   extra_button=1,
                                   extra_label="No Config",
                                   title="Exclude Configuration Tasks")
        tags = [x.strip('"') for x in tags]  # Needed for OpenSUSE

        if code in (d.CANCEL, d.ESC):
            return False
        elif code == d.HELP:
            help_file = get_help_file("configuration_tasks")
            assert os.path.exists(help_file)
            d.textbox(help_file,
                      title="Configuration Tasks",
                      width=70,
                      height=40)
        # No Config button
        elif code == d.EXTRA:
            session['excluded_tasks'] = [-1]
            session['task_metadata'] = ["EXCLUDE_ALL_TASKS"]
            break
        elif code == d.OK:
            session['excluded_tasks'] = []
            for tag in tags:
                session['excluded_tasks'].append(mapping[int(tag)])

            exclude_metadata = []
            for task in session['excluded_tasks']:
                exclude_metadata.extend(CONFIGURATION_TASKS[task][1])

            session['task_metadata'] = [
                "EXCLUDE_TASK_%s" % x for x in exclude_metadata
            ]
            break

    return True