예제 #1
0
def activate_set(cmd_path, full_path, options, tree=None):
    if is_hidden(options.set_name) and not options.all:
        raise rts_exceptions.NoConfSetError(options.set_name)
    tree, comp = get_comp(cmd_path, full_path, tree)
    if not options.set_name in comp.conf_sets:
        raise rts_exceptions.NoConfSetError(options.set_name)
    comp.activate_conf_set(options.set_name)
예제 #2
0
def get_conf_value(param, cmd_path, full_path, options, tree=None):
    tree, comp = get_comp(cmd_path, full_path, tree)

    if not options.set_name:
        options.set_name = comp.active_conf_set_name
    if is_hidden(options.set_name) and not options.all:
        raise rts_exceptions.NoConfSetError(options.set_name)

    if not options.set_name in comp.conf_sets:
        raise rts_exceptions.NoConfSetError(options.set_name)
    if not param in comp.conf_sets[options.set_name].data:
        raise rtctree.exceptions.NoSuchConfParamError(param)
    return [comp.conf_sets[options.set_name].data[param]]
예제 #3
0
def print_conf_sets(cmd_path, full_path, options, tree=None):
    use_colour = rtctree.utils.colour_supported(sys.stdout)
    tree, comp = get_comp(cmd_path, full_path, tree)

    if options.set_name:
        if is_hidden(options.set_name) and not options.all:
            raise rts_exceptions.NoConfSetError(options.set_name)
        if not options.set_name in comp.conf_sets:
            raise rts_exceptions.NoConfSetError(options.set_name)
        return format_conf_set(options.set_name,
                               comp.conf_sets[options.set_name],
                               options.set_name == comp.active_conf_set_name,
                               use_colour, options.long)
    else:
        return format_conf_sets(comp.conf_sets, comp.active_conf_set_name,
                                options.all, use_colour, options.long)
예제 #4
0
def set_conf_value(param, new_value, cmd_path, full_path, options, tree=None):
    tree, comp = get_comp(cmd_path, full_path, tree)

    if not options.set_name:
        options.set_name = comp.active_conf_set_name
    if is_hidden(options.set_name) and not options.all:
        raise rts_exceptions.NoConfSetError(options.set_name)
    comp.set_conf_set_value(options.set_name, param, new_value)
    if options.set_name == comp.active_conf_set_name:
        # Re-activate the set to update the config param internally in the
        # component.
        comp.activate_conf_set(options.set_name)