From: Alberto L. C. (Pexego) <al...@pe...> - 2010-03-29 15:02:25
|
Hi all! Me and a workmate are currently working in an approach of connecting to different LDAP servers (each one is a replica of another) because of fault tolerancy purposes. So, first thing we did was modifying the *__init__* method of SimpleLDAPObject class (ldapobject.py file) adding a new attribute "pool" which contains the list of servers passed as param in *initialize* method as a string. So, attribute .*_l *changes to: self._l = ldap.functions._ldap_function_call(_ldap.initialize,self._pool[0]) Then, in *_ldap_call *we introduced a /while/ loop surrounding all code with a boolean condition set to False. When *"func"* call fails raising a "SERVER_DOWN" exception, we remove URI from pool and create a new ReconnectLDAPObject instance with self._l attribute pointing to next LDAP URI in pool. The problem we're actually facing is that when *func *calls raises a SERVER_DOWN exception (with, for example, a *search_s* operation) the code behaviour is correct when URI is wrong, but when LDAP URI is right the func calls stills raises an exception...Is this because of what is explained in the beginning of ReconnectLDAPObject class (that synchronous methods like search_s() automatically tries to reconnect when LDAP server is down)?. Are we pointing in the right direction? Thanks a lot in advance. |