another odd problem... with ldap restart

Anil Jangity anilj at entic.net
Tue Mar 20 22:12:39 CET 2007


Cool, that was the problem! Where is ReconnectLDAPObject documented?
Don't think I've seen it before in the docs.



On 3/20/07, Alain Spineux <aspineux at gmail.com> wrote:
> You are working asynchronously !
>
> add a ldap.result() into your try: except or use the synchronous
> ldap.search_s()
> method and you will get your error in the expected order.
>
> I you want to survive to ldap restart, use the ReconnectLDAPObject that do
> the job nicely.
>
> BUT this let a good QUESTION :
>
> If I start 10 asynchronous ldap requests when the server is down,
> how many exception will I get ? 1 or 10 ? easy to test :-)
>
>
>
> On 3/20/07, Anil Jangity <anilj at entic.net> wrote:
> >
> > If I restart the LDAP server, while connected to it using python-ldap,
> > it doesn't seem to be throwing an exception at the right time.
> >
> > self.logger('*** about to do a search ***')
> > result = g.ldap[customer][uid].search(base=suffix,
> scope="base", attr=["dn"])
> > self.logger('*** finished search ***')
> >
> > g.ldap is a wrapper method that just does this:
> > try:
> > self.logger('1')
> > ldap_result_id = self.l.search(ldap_url.dn, ldap_url.scope,
> > ldap_url.filterstr, ldap_url.attrs)
> > self.logger('2')
> > except ldap.LDAPError, e:
> > self.logger("LDAP SEARCH failed: %s" % (e))
> > return False
> >
> > Once connected to the ldap server, I do stop-start ldap server. Then,
> > I do two searches in order. The 2nd search throws an exception "Can't
> > contact LDAP server". I am just wondering why it doesn't do it the
> > first time?
> >
> > Mar 20 09:43:35 DEBUG 127.0.0.1 *** about to do a search ***
> > Mar 20 09:43:35 INFO LDAP SEARCH: dn: uid=demo, ou=People, o= entic.net
> > scope: 0 filter: (objectClass=top)
> > Mar 20 09:43:35 INFO 1
> > Mar 20 09:43:35 INFO 2
> > Mar 20 09:43:36 DEBUG 127.0.0.1 *** about to do a search ***
> > Mar 20 09:43:36 INFO LDAP SEARCH: dn: uid=demo, ou=People, o=entic.net
> > scope: 0 filter: (objectClass=top)
> > Mar 20 09:43:36 INFO 1
> > Mar 20 09:43:36 INFO LDAP SEARCH failed: {'info': '', 'desc': "Can't
> > contact LDAP server"}
> > Mar 20 09:43:36 DEBUG 127.0.0.1 *** finished search ***
> >
> >
> 


More information about the python-ldap mailing list