From 0cd84ab08b8d04bd40327cdc96dc63d5a394a50f Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Mon, 1 Aug 2016 10:39:25 -0400 Subject: [PATCH] Ticket 48946 - openConnection should not fully popluate DirSrv object Description: Whne opening a connection to a server, there is no need to populate the DirDrv object which issues several searches. https://fedorahosted.org/389/ticket/48946 Reviewed by: ? --- lib389/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib389/__init__.py b/lib389/__init__.py index f19a1d0..c84c38d 100644 --- a/lib389/__init__.py +++ b/lib389/__init__.py @@ -545,14 +545,15 @@ class DirSrv(SimpleLDAPObject): self.port))) def openConnection(self, saslmethod=None, certdir=None): - # Open a new connection to our LDAP server + """Open a new connection to our LDAP server + """ server = DirSrv(verbose=self.verbose) args_instance[SER_HOST] = self.host args_instance[SER_PORT] = self.port args_instance[SER_SERVERID_PROP] = self.serverid args_standalone = args_instance.copy() server.allocate(args_standalone) - server.open(saslmethod, certdir) + server.open(saslmethod, certdir, connOnly=True) return server @@ -970,7 +971,7 @@ class DirSrv(SimpleLDAPObject): self.state = DIRSRV_STATE_ALLOCATED - def open(self, saslmethod=None, certdir=None, starttls=False): + def open(self, saslmethod=None, certdir=None, starttls=False, connOnly=False): ''' It opens a ldap bound connection to dirsrv so that online administrative tasks are possible. It binds with the binddn @@ -1055,7 +1056,8 @@ class DirSrv(SimpleLDAPObject): """ if self.verbose: log.info("open(): bound as %s" % self.binddn) - self.__initPart2() + if not connOnly: + self.__initPart2() self.state = DIRSRV_STATE_ONLINE def close(self): -- 2.4.11