def regex_edit(inst, basedn, log, args): log = log.getChild('regex_edit') definitions = AutoMembershipDefinitions(inst) definition = definitions.get(args.DEFNAME) regexes = AutoMembershipRegexRules(inst, definition.dn) regex = regexes.get(args.REGEXNAME) generic_object_edit(regex, log, args, arg_to_attr_regex)
def regex_del(inst, basedn, log, args): log = log.getChild('regex_del') definitions = AutoMembershipDefinitions(inst) definition = definitions.get(args.DEFNAME) regexes = AutoMembershipRegexRules(inst, definition.dn) regex = regexes.get(args.REGEXNAME) regex.delete() log.info("Successfully deleted the %s regex", args.REGEXNAME)
def regex_show(inst, basedn, log, args): log = log.getChild('regex_show') definitions = AutoMembershipDefinitions(inst) definition = definitions.get(args.DEFNAME) regexes = AutoMembershipRegexRules(inst, definition.dn) regex = regexes.get(args.REGEXNAME) if not regex.exists(): raise ldap.NO_SUCH_OBJECT("Entry %s doesn't exists" % args.REGEXNAME) if args and args.json: o_str = regex.get_all_attrs_json() log.info(o_str) else: log.info(regex.display())