diff options
author | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2015-08-14 10:05:42 +0200 |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2015-08-14 10:05:42 +0200 |
commit | 7ea7399a6d32f65fe670e8e31b60f22bd2132fd2 (patch) | |
tree | c127ea8bc856bcb73c24f81a2ec87f7e9d5cb74f /kolabd | |
parent | f77cbb401b48109258c6ed8d09151e7254bee4ad (diff) | |
download | pykolab-7ea7399a6d32f65fe670e8e31b60f22bd2132fd2.tar.gz |
Correct detecting naming contexts for databases to synchronize against, and using parent domain name spaces for synchronization
Diffstat (limited to 'kolabd')
-rw-r--r-- | kolabd/__init__.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/kolabd/__init__.py b/kolabd/__init__.py index 26d6001..7ed2c9d 100644 --- a/kolabd/__init__.py +++ b/kolabd/__init__.py @@ -270,13 +270,18 @@ class KolabDaemon(object): # domains now is a list of tuples in the format of # ('primary',[secondaries]), we want the primary_domains + domain_base_dns = [] primary_domains = [] - for primary_domain, secondaries in domains: + for primary_domain, secondaries in domains.iteritems(): domain_base_dn = primary_auth.domain_naming_context(primary_domain) + log.debug(_("Domain Base DN for domain %r is %r") % (primary_domain, domain_base_dn), level=8) if not domain_base_dn == None: - if not domain_base_dn in primary_domains: - primary_domains.append(domain_base_dn) + if not domain_base_dn in domain_base_dns: + domain_base_dns.append(domain_base_dn) + primary_domains.append(primary_domain) + + log.debug(_("Naming contexts to synchronize: %r") % (primary_domains), level=8) # Now we can check if any changes happened. added_domains = [] @@ -284,18 +289,27 @@ class KolabDaemon(object): # Combine the domains from LDAP with the domain processes # accounted for locally. - all_domains = set(primary_domains + domain_auth.keys()) + all_domains = list(set(primary_domains + domain_auth.keys())) + + log.debug(_("All naming contexts: %r") % (all_domains), level=8) for domain in all_domains: + log.debug(_("Checking for domain %s") % (domain), level=8) + if domain in domain_auth.keys() and domain in primary_domains: if not domain_auth[domain].is_alive(): + log.debug(_("Domain %s isn't alive anymore.") % (domain), level=8) domain_auth[domain].terminate() added_domains.append(domain) else: + log.debug(_("Domain %s already there and alive.") % (domain), level=8) continue + elif domain in domain_auth.keys(): + log.debug(_("Domain %s should not exist any longer.") % (domain), level=8) removed_domains.append(domain) else: + log.debug(_("Domain %s does not have a process yet.") % (domain), level=8) added_domains.append(domain) if len(removed_domains) == 0 and len(added_domains) == 0: |