Unverified Commit 14be560b authored by Peter Stanko's avatar Peter Stanko
Browse files

LDAP connection should be single instance

parent 254078f4
Pipeline #13214 passed with stage
in 36 minutes and 52 seconds
......@@ -57,7 +57,6 @@ class LDAPWrapper(object):
log.info(f"[LDAP] Creating LDAP server instance {self.ldap_url}: {self._ldap_server}")
return self._ldap_server
@property
def ldap_connection(self):
connection = None
if self.ldap is not None:
......@@ -68,8 +67,9 @@ class LDAPWrapper(object):
def search(self, selector: str):
selector = selector + self.selector_base
log.debug(f"[LDAP] Search {self.ldap_url}: ({selector})")
self.ldap_connection.search(selector, '(objectclass=*)', attributes=ldap3.ALL_ATTRIBUTES)
entries = self.ldap_connection.entries
conn = self.ldap_connection()
conn.search(selector, '(objectclass=*)', attributes=ldap3.ALL_ATTRIBUTES)
entries = conn.entries
if entries:
result = entries[0]
log.debug(f"[LDAP] Search ({selector}): {result}")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment