Skip to content
Browse files

Make that connection interface a little more intuitive.

  • Loading branch information...
1 parent 0595f90 commit 91c8247674b057d4997149dd33aa7753e93e6838 @mjessome committed Apr 3, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 scripts/autoland/utils/ldap_utils.py
View
9 scripts/autoland/utils/ldap_utils.py
@@ -20,11 +20,14 @@ def __init__(self, host, port, branch_api='', bind_dn='', password=''):
self.port = port
self.bind_dn = bind_dn
self.password = password
- self.connection = self._connect()
+ self.connection = None
self.branch_api = branch_api
+ self._connect()
+
def _connect(self):
- return ldap.initialize('ldap://%s:%s' % (self.host, self.port))
+ self.connection = ldap.initialize('ldap://%s:%s'
+ % (self.host, self.port))
def _bind(self):
self.connection.simple_bind(self.bind_dn, self.password)
@@ -54,7 +57,7 @@ def search(self, bind, filterstr, attrlist=None,
break
except:
log.error("Connection to LDAP lost. Reconnect #%d" % (i))
- self.connection = self._connect()
+ self._connect()
return result

0 comments on commit 91c8247

Please sign in to comment.
Something went wrong with that request. Please try again.