]> Frank Brehm's Git Trees - pixelpark/ldap-migration.git/commitdiff
Collecting unknown object classes
authorFrank Brehm <frank.brehm@pixelpark.com>
Fri, 5 Mar 2021 16:00:59 +0000 (17:00 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Fri, 5 Mar 2021 16:00:59 +0000 (17:00 +0100)
lib/ldap_migration/__init__.py

index 1db3dd87f855b0bd58200465c13ba7d9f4e8046a..18248e88e8bbc80c6e956730f25e4ee57b799ee4 100644 (file)
@@ -47,7 +47,7 @@ from fb_tools.collections import FrozenCIStringSet, CIStringSet, CIDict
 
 from .config import LDAPMigrationConfiguration
 
-__version__ = '0.10.6'
+__version__ = '0.10.7'
 
 LOG = logging.getLogger(__name__)
 CFG_BASENAME = 'ldap-migration.ini'
@@ -782,6 +782,17 @@ class LDAPMigrationApplication(BaseApplication):
             src_val = src_entry['attributes'][attribute]
             val = 0
 
+            if key.lower() == 'objectclass':
+                if is_sequence(src_val):
+                    for oc in src_val:
+                        if oc not in self.object_classes:
+                            if self.verbose > 3:
+                                msg = "ObjectClass {oc!r} of source entry {dn!r} not found "
+                                msg += "on target LDAP server."
+                                msg = msg.format(oc=src_oc_name, dn=src_dn)
+                                LOG.debug(msg)
+                            self.unknown_objectclasses.add(oc)
+
             if attribute in self.integer_attribute_types:
                 val = self._get_integer_value(src_val)
 
@@ -1605,10 +1616,11 @@ class LDAPMigrationApplication(BaseApplication):
                     LOG.debug(msg.format(oc=src_oc_name, dn=tgt_dn))
                 if src_oc_name not in self.object_classes:
                     if self.verbose > 3:
-                        msg = "ObjectClass {oc!r} of sorce entry {dn!r} not found "
+                        msg = "ObjectClass {oc!r} of source entry {dn!r} not found "
                         msg += "on target LDAP server."
                         msg = msg.format(oc=src_oc_name, dn=src_dn)
                         LOG.debug(msg)
+                    self.unknown_objectclasses.add(oc)
                     continue
                 tgt_oc_name = self.object_classes.real_key(src_oc_name)
                 objectclasses_to_add.append(tgt_oc_name)