From: Frank Brehm Date: Mon, 16 Nov 2020 15:48:53 +0000 (+0100) Subject: Registration of all structural entries X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=80cc2168bd7d16bd500dd0ab2fddfc8dac89a1f4;p=pixelpark%2Fldap-migration.git Registration of all structural entries --- diff --git a/lib/ldap_migration/__init__.py b/lib/ldap_migration/__init__.py index 533afa4..5c96d10 100644 --- a/lib/ldap_migration/__init__.py +++ b/lib/ldap_migration/__init__.py @@ -35,7 +35,7 @@ from fb_tools.errors import FbAppError from .config import LDAPMigrationConfiguration from .idict import CaseInsensitiveDict -__version__ = '0.5.2' +__version__ = '0.5.3' LOG = logging.getLogger(__name__) CFG_BASENAME = 'ldap-migration.ini' @@ -627,7 +627,7 @@ class LDAPMigrationApplication(BaseApplication): new_dn = self.mangle_dn(old_dn) if self.verbose > 2: LOG.debug("Found DN {!r}.".format(old_dn)) - self.register_dn_tokens(old_dn, entry['attributes']['objectClass']) + self.register_dn_tokens(old_dn, entry['attributes']['objectClass'], self.dns) fh.write("{old} => {new}\n".format(old=old_dn, new=new_dn)) # if item_count >= 100: # break @@ -656,6 +656,8 @@ class LDAPMigrationApplication(BaseApplication): LOG.info("Found {nr} structural items in subtree of {sfx!r}.".format( nr=count_dns, sfx=self.config.suffix)) + if self.verbose > 2: + LOG.debug("Registred structural DN tokens:\n{}".format(pp(self.struct_dns.as_dict()))) # ------------------------------------------------------------------------- def _get_structural_dns(self, fh, cur_hash, count_dns, is_root=False): @@ -683,6 +685,8 @@ class LDAPMigrationApplication(BaseApplication): count_dns += 1 + self.register_dn_tokens(my_dn, cur_hash['object_classes'], cur_hash=self.struct_dns) + for key in cur_hash['childs'].keys(): count_dns = self._get_structural_dns(fh, cur_hash['childs'][key], count_dns, False)