From ff886940272354743cd6eb50717891454d8e5500 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 17 Sep 2013 08:19:47 -0700 Subject: [PATCH] Give slapd a second to startup Moving the sleep to the beginning of the loop avoids most occurrences of the "connection failed" message Signed-off-by: Howard Chu Reviewed-by: Andrew Bartlett Reviewed-by: Nadezhda Ivanova Autobuild-User(master): Nadezhda Ivanova Autobuild-Date(master): Wed Sep 18 07:43:09 CEST 2013 on sn-devel-104 --- python/samba/provision/backend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/samba/provision/backend.py b/python/samba/provision/backend.py index 58aab9829f3..24d86752583 100644 --- a/python/samba/provision/backend.py +++ b/python/samba/provision/backend.py @@ -292,6 +292,7 @@ class LDAPBackend(ProvisionBackend): while self.slapd.poll() is None: # Wait until the socket appears try: + time.sleep(1) ldapi_db = Ldb(self.ldap_uri, lp=self.lp, credentials=self.credentials) ldapi_db.search(base="", scope=SCOPE_BASE, expression="(objectClass=OpenLDAProotDSE)") @@ -299,7 +300,6 @@ class LDAPBackend(ProvisionBackend): # the LDAP server! return except LdbError: - time.sleep(1) count = count + 1 if count > 15: