Ejemplo n.º 1
0
def def_config_set(inst, basedn, log, args):
    chain_cfg = ChainingDefault(inst)
    attrs = _args_to_attrs(args)
    did_something = False
    replace_list = []

    for attr, value in list(attrs.items()):
        if value is False:
            value = "off"
        elif value is True:
            value = "on"
        if value == "":
            # Delete value
            chain_cfg.remove_all(attr)
            did_something = True
        else:
            replace_list.append((attr, value))
    if len(replace_list) > 0:
        chain_cfg.replace_many(*replace_list)
    elif not did_something:
        raise ValueError(
            "There are no changes to set in the chaining default instance creation configuration"
        )

    print(
        "Successfully updated chaining default instance creation configuration"
    )
Ejemplo n.º 2
0
def def_config_get(inst, basedn, log, args):
    def_chain_cfg = ChainingDefault(inst)
    if args and args.json:
        print(def_chain_cfg.get_all_attrs_json())
    else:
        print(def_chain_cfg.display())