summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-04-28 10:39:05 +1000
committerAndrew Bartlett <abartlet@samba.org>2010-04-28 10:39:57 +1000
commit3c585e9a8068d5065b1a5f320ffd130290c1cd07 (patch)
tree8de6df88b997cad92854c2a81cbc3db34c85094c /source4/scripting
parent4d1f0436bd4f63887173473541efa205fb98210f (diff)
downloadsamba-3c585e9a8068d5065b1a5f320ffd130290c1cd07.tar.gz
samba-3c585e9a8068d5065b1a5f320ffd130290c1cd07.tar.bz2
samba-3c585e9a8068d5065b1a5f320ffd130290c1cd07.zip
s4:provisionbackend Don't loop forever waiting for OpenLDAP
We need to give a good error when we can't get OpenLDAP to accept our connections. Andrew Bartlett
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/provisionbackend.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/provisionbackend.py b/source4/scripting/python/samba/provisionbackend.py
index 25e416ce04..8d035ab670 100644
--- a/source4/scripting/python/samba/provisionbackend.py
+++ b/source4/scripting/python/samba/provisionbackend.py
@@ -222,6 +222,7 @@ class LDAPBackend(ProvisionBackend):
self.slapd = subprocess.Popen(self.slapd_provision_command,
close_fds=True, shell=False)
+ count = 0
while self.slapd.poll() is None:
# Wait until the socket appears
try:
@@ -232,6 +233,11 @@ class LDAPBackend(ProvisionBackend):
return
except LdbError:
time.sleep(1)
+ count = count + 1
+
+ if count > 15:
+ self.message("Could not connect to slapd started with: %s" % "\'" + "\' \'".join(self.slapd_provision_command) + "\'")
+ raise ProvisioningError("slapd never accepted a connection within 15 seconds of starting")
self.message("Could not start slapd with: %s" % "\'" + "\' \'".join(self.slapd_provision_command) + "\'")
raise ProvisioningError("slapd died before we could make a connection to it")