From: Frank Brehm Date: Thu, 27 Oct 2022 12:08:42 +0000 (+0200) Subject: Defining structural entries in mirror-ldap X-Git-Tag: 0.7.0^2~1^2~20 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=3cab9312d1fd0de246d729598054b487fbcd55ae;p=pixelpark%2Fpp-admin-tools.git Defining structural entries in mirror-ldap --- diff --git a/lib/pp_admintools/app/mirror_ldap.py b/lib/pp_admintools/app/mirror_ldap.py index 73a5bc7..e66056d 100644 --- a/lib/pp_admintools/app/mirror_ldap.py +++ b/lib/pp_admintools/app/mirror_ldap.py @@ -37,7 +37,7 @@ from .ldap import BaseLdapApplication from ..argparse_actions import NonNegativeItegerOptionAction from ..argparse_actions import LimitedFloatOptionAction -__version__ = '0.6.0' +__version__ = '0.6.1' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -74,8 +74,11 @@ class MirrorLdapApplication(BaseLdapApplication): self.src_connect_info = None self.tgt_connect_info = None - self.src_dns = [] + self.src_dns = CIDict() + self.src_struct_dns = CIStringSet() + self.tgt_dns_current = CIDict() + self.tgt_struct_dns_current = CIStringSet() self.limit = 0 self.wait_after_write = self.default_wait_after_write @@ -295,6 +298,18 @@ class MirrorLdapApplication(BaseLdapApplication): msg = _("Found DNs in instance {!r}:").format(self.src_instance) LOG.debug(msg + '\n' + pp(sorted_dns)) + self.src_struct_dns = CIStringSet() + for dn in sorted_dns: + + entry = self.src_dns[dn] + if not entry['childs']: + continue + self.src_struct_dns.add(dn) + + if self.verbose > 2: + msg = _("Found structural DNs in instance {!r}:").format(self.src_instance) + LOG.debug(msg + '\n' + pp(self.src_struct_dns.as_list())) + # ------------------------------------------------------------------------- def get_current_tgt_entries(self): """Get DNs of all entries in the target LDAP instance and sort them.""" @@ -317,6 +332,18 @@ class MirrorLdapApplication(BaseLdapApplication): msg = _("Found DNs in instance {!r}:").format(self.tgt_instance) LOG.debug(msg + '\n' + pp(sorted_dns)) + self.tgt_struct_dns_current = CIStringSet() + for dn in sorted_dns: + + entry = self.tgt_dns_current[dn] + if not entry['childs']: + continue + self.tgt_struct_dns_current.add(dn) + + if self.verbose > 2: + msg = _("Found structural DNs in instance {!r}:").format(self.tgt_instance) + LOG.debug(msg + '\n' + pp(self.tgt_struct_dns_current.as_list())) + # ------------------------------------------------------------------------- def eval_sync_entries(self): """Evaluating entries, which have to be synced, instead of to be removed and recreated."""