Give slapd a second to startup
authorHoward Chu <hyc@symas.com>
Tue, 17 Sep 2013 15:19:47 +0000 (08:19 -0700)
committerNadezhda Ivanova <nivanova@samba.org>
Wed, 18 Sep 2013 05:43:09 +0000 (07:43 +0200)
Moving the sleep to the beginning of the loop avoids most
occurrences of the "connection failed" message

Signed-off-by: Howard Chu <hyc@symas.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova@symas.com>
Autobuild-User(master): Nadezhda Ivanova <nivanova@samba.org>
Autobuild-Date(master): Wed Sep 18 07:43:09 CEST 2013 on sn-devel-104

python/samba/provision/backend.py

index 58aab9829f336622d639ee9ec19214b175e39a14..24d8675258375e8487e5812cbc629d1464ce6931 100644 (file)
@@ -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: