From 5184c312f6dd1a885c9e0e10e3763eddb8110bae Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 23 Jan 2013 10:05:21 -0500 Subject: replace getEntry with get_entry (or get_entries if scope != SCOPE_BASE) Part of the work for: https://fedorahosted.org/freeipa/ticket/2660 --- ipaserver/ipaldap.py | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'ipaserver/ipaldap.py') diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py index 00dff18f..b4d0a5d9 100644 --- a/ipaserver/ipaldap.py +++ b/ipaserver/ipaldap.py @@ -1621,17 +1621,6 @@ class IPAdmin(LDAPClient): self.__bind_with_wait( self.sasl_interactive_bind_s, timeout, None, auth_tokens) - def getEntry(self, base, scope, filterstr='(objectClass=*)', - attrlist=None): - # FIXME: for backwards compatibility only - result, truncated = self.find_entries( - filter=filterstr, - attrs_list=attrlist, - base_dn=base, - scope=scope, - ) - return result[0] - def updateEntry(self,dn,oldentry,newentry): # FIXME: for backwards compatibility only """This wraps the mod function. It assumes that the entry is already @@ -1728,7 +1717,6 @@ class IPAdmin(LDAPClient): return True def waitForEntry(self, dn, timeout=7200, attr='', quiet=True): - scope = ldap.SCOPE_BASE filter = "(objectclass=*)" attrlist = [] if attr: @@ -1747,10 +1735,11 @@ class IPAdmin(LDAPClient): entry = None while not entry and int(time.time()) < timeout: try: - entry = self.getEntry(dn, scope, filter, attrlist) - except ldap.NO_SUCH_OBJECT: - pass # no entry yet - except ldap.LDAPError, e: # badness + [entry] = self.get_entries( + dn, ldap.SCOPE_BASE, filter, attrlist) + except errors.NotFound: + pass # no entry yet + except Exception, e: # badness print "\nError reading entry", dn, e break if not entry: -- cgit