From fc8ac693726ec33b5c0924f9b8ff5d663705a5a3 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Fri, 5 Dec 2008 15:31:18 -0500 Subject: Port plugins to use the new output_for_cli() argument list Fix some errors uncovered by the nosetests --- ipa_server/ipaldap.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ipa_server/ipaldap.py') diff --git a/ipa_server/ipaldap.py b/ipa_server/ipaldap.py index 7cfd6c41..215ef683 100644 --- a/ipa_server/ipaldap.py +++ b/ipa_server/ipaldap.py @@ -375,7 +375,7 @@ class IPAdmin(SimpleLDAPObject): except ldap.ALREADY_EXISTS, e: raise errors.DuplicateEntry, "Entry already exists" except ldap.LDAPError, e: - raise e + raise DatabaseError, e return True def updateRDN(self, dn, newrdn): @@ -392,7 +392,7 @@ class IPAdmin(SimpleLDAPObject): self.set_option(ldap.OPT_SERVER_CONTROLS, sctrl) self.modrdn_s(dn, newrdn, delold=1) except ldap.LDAPError, e: - raise e + raise DatabaseError, e return True def updateEntry(self,dn,oldentry,newentry): @@ -474,7 +474,7 @@ class IPAdmin(SimpleLDAPObject): self.set_option(ldap.OPT_SERVER_CONTROLS, sctrl) self.modify_s(dn, modlist) except ldap.LDAPError, e: - raise e + raise DatabaseError, e return True def deleteEntry(self,*args): @@ -486,8 +486,10 @@ class IPAdmin(SimpleLDAPObject): if sctrl is not None: self.set_option(ldap.OPT_SERVER_CONTROLS, sctrl) self.delete_s(*args) + except ldap.INSUFFICIENT_ACCESS, e: + raise errors.InsufficientAccess, e except ldap.LDAPError, e: - raise e + raise errors.DatabaseError, e return True def modifyPassword(self,dn,oldpass,newpass): -- cgit From 5ad47d70bee9858506fbff5a9327ca081deea495 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Wed, 10 Dec 2008 16:41:36 -0500 Subject: The Python re module doesn't count parens so remove any trailing ) from notfound --- ipa_server/ipaldap.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ipa_server/ipaldap.py') diff --git a/ipa_server/ipaldap.py b/ipa_server/ipaldap.py index 215ef683..e7c56e5d 100644 --- a/ipa_server/ipaldap.py +++ b/ipa_server/ipaldap.py @@ -535,7 +535,10 @@ def notfound(args): if len(args) > 2: searchfilter = args[2] try: + # Python re doesn't do paren counting so the string could + # have a trailing paren "foo)" target = re.match(r'\(.*=(.*)\)', searchfilter).group(1) + target.replace(")","") except: target = searchfilter return "%s not found" % str(target) -- cgit From cfdd272166a2689b2f50e5df65e1304a2040633d Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Thu, 11 Dec 2008 10:30:43 -0500 Subject: Actually replace trailing ) characters with '' --- ipa_server/ipaldap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ipa_server/ipaldap.py') diff --git a/ipa_server/ipaldap.py b/ipa_server/ipaldap.py index e7c56e5d..f520475e 100644 --- a/ipa_server/ipaldap.py +++ b/ipa_server/ipaldap.py @@ -538,7 +538,7 @@ def notfound(args): # Python re doesn't do paren counting so the string could # have a trailing paren "foo)" target = re.match(r'\(.*=(.*)\)', searchfilter).group(1) - target.replace(")","") + target = target.replace(")","") except: target = searchfilter return "%s not found" % str(target) -- cgit