]> Frank Brehm's Git Trees - pixelpark/ldap-migration.git/commitdiff
Counting ignored entries
authorFrank Brehm <frank.brehm@pixelpark.com>
Thu, 7 Jan 2021 17:16:01 +0000 (18:16 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Thu, 7 Jan 2021 17:16:01 +0000 (18:16 +0100)
lib/ldap_migration/__init__.py

index 8f948b4390a269926802bf0f2265d9e3c2728a49..76fe29eb53118ec305e1438b0726fed587b72b33 100644 (file)
@@ -45,7 +45,7 @@ from fb_tools.collections import CIStringSet, CIDict
 
 from .config import LDAPMigrationConfiguration
 
-__version__ = '0.9.10'
+__version__ = '0.9.11'
 
 LOG = logging.getLogger(__name__)
 CFG_BASENAME = 'ldap-migration.ini'
@@ -207,6 +207,7 @@ class LDAPMigrationApplication(BaseApplication):
         self.struct_entries = []
         self.all_entries = []
         self.group_entries = CIDict()
+        self.ignored_entries = CIStringSet()
 
         self.limit = 0
 
@@ -1578,6 +1579,7 @@ class LDAPMigrationApplication(BaseApplication):
                 tgt_dn.lower().startswith('uid=')):
             LOG.info("Entry {!r} is a Samba Computer entry and will not be migrated.".format(
                 src_dn))
+            self.ignored_entries.add(src_dn)
             return False
 
         LOG.debug("Migrating source DN {sdn!r} -> {tdn!r}.".format(
@@ -1794,13 +1796,16 @@ class LDAPMigrationApplication(BaseApplication):
         if self.group_entries:
             count_groups = len(self.group_entries)
 
+        count_ignored = len(self.ignored_entries)
+
         print()
-        total = self.count_unchanged + self.count_added + self.count_modified + count_groups
+        total = self.count_unchanged + self.count_added + self.count_modified
+        total += count_groups + count_ignored
         msg = (
             "Performed all entries: {to} total, {ad} added, {mo} modified, "
-            "{un} unchanged, {g} ignored groups.").format(
+            "{un} unchanged, {g} ignored groups, {ig} ignored items.").format(
                     to=total, ad=self.count_added, mo=self.count_modified,
-                    un=self.count_unchanged, g=count_groups)
+                    un=self.count_unchanged, g=count_groups, ig=count_ignored)
         LOG.info(msg)
         print()