summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-02-11 13:12:58 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-02-11 13:12:58 +0100
commit84133cf3535c77dac77ac1f41955c6594f357a58 (patch)
tree09c3a0b911ae7ea00f83514b5abc468da1f22a56
parent78ed8f6bdce55e01c23bb51e328c866bff46fafa (diff)
downloadpykolab-84133cf3535c77dac77ac1f41955c6594f357a58.tar.gz
Avoid connection errors being fatal.
Sleep and continue should we have an empty list of domains
-rw-r--r--kolabd/__init__.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/kolabd/__init__.py b/kolabd/__init__.py
index 3f43872..5b3c5fa 100644
--- a/kolabd/__init__.py
+++ b/kolabd/__init__.py
@@ -220,6 +220,15 @@ class KolabDaemon(object):
while 1:
primary_auth = Auth(primary_domain)
+ connected = False
+ while not connected:
+ try:
+ connected = primary_auth.connect()
+ except Exception, errmsg:
+ connected = False
+ log.error(_("Could not connect to LDAP, is it running?"))
+ time.sleep(5)
+
log.debug(_("Listing domains..."), level=5)
start = time.time()
@@ -230,6 +239,11 @@ class KolabDaemon(object):
time.sleep(60)
continue
+ if isinstance(domains, list) and len(domains) < 1:
+ log.error(_("No domains. Not syncing"))
+ time.sleep(5)
+ continue
+
# domains now is a list of tuples, we want the primary_domains
primary_domains = []
for primary_domain in list(set(domains.values())):