def mep_config_edit(inst, basedn, log, args): log = log.getChild('mep_config_edit') plugin = ManagedEntriesPlugin(inst) config_area = plugin.get_attr_val_utf8_l('nsslapd-pluginConfigArea') configs = MEPConfigs(inst, config_area) config = configs.get(args.NAME) generic_object_edit(config, log, args, arg_to_attr_config)
def mep_config_del(inst, basedn, log, args): log = log.getChild('mep_config_del') plugin = ManagedEntriesPlugin(inst) config_area = plugin.get_attr_val_utf8_l('nsslapd-pluginConfigArea') configs = MEPConfigs(inst, config_area) config = configs.get(args.NAME) config.delete() log.info("Successfully deleted the %s", config.dn)
def mep_config_add(inst, basedn, log, args): log = log.getChild('mep_config_add') plugin = ManagedEntriesPlugin(inst) config_area = plugin.get_attr_val_utf8_l('nsslapd-pluginConfigArea') if config_area is None: config_area = plugin.dn props = {'cn': args.NAME} generic_object_add(MEPConfig, inst, log, args, arg_to_attr_config, basedn=config_area, props=props)
def mep_config_show(inst, basedn, log, args): log = log.getChild('mep_config_show') plugin = ManagedEntriesPlugin(inst) config_area = plugin.get_attr_val_utf8_l('nsslapd-pluginConfigArea') configs = MEPConfigs(inst, config_area) config = configs.get(args.NAME) if not config.exists(): raise ldap.NO_SUCH_OBJECT("Entry %s doesn't exists" % args.name) if args and args.json: o_str = config.get_all_attrs_json() log.info(o_str) else: log.info(config.display())
def mep_config_list(inst, basedn, log, args): log = log.getChild('mep_config_list') plugin = ManagedEntriesPlugin(inst) config_area = plugin.get_attr_val_utf8_l('nsslapd-pluginConfigArea') configs = MEPConfigs(inst, config_area) result = [] result_json = [] for config in configs.list(): if args.json: result_json.append(json.loads(config.get_all_attrs_json())) else: result.append(config.rdn) if args.json: log.info(json.dumps({"type": "list", "items": result_json}, indent=4)) else: if len(result) > 0: for i in result: log.info(i) else: log.info("No Managed Entry plugin instances")