]> Frank Brehm's Git Trees - pixelpark/ldap-migration.git/commitdiff
Registration of all structural entries
authorFrank Brehm <frank.brehm@pixelpark.com>
Mon, 16 Nov 2020 15:48:53 +0000 (16:48 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Mon, 16 Nov 2020 15:48:53 +0000 (16:48 +0100)
lib/ldap_migration/__init__.py

index 533afa4dcab6e0efe58ff35575e241d188086a44..5c96d1071589bc77e817538c8e5fdfee6d990a71 100644 (file)
@@ -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)