From 8a9b045f3b9edaecd57f9aa0f81d31ce818a1ebe Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Thu, 7 Jan 2021 18:16:01 +0100 Subject: [PATCH] Counting ignored entries --- lib/ldap_migration/__init__.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/ldap_migration/__init__.py b/lib/ldap_migration/__init__.py index 8f948b4..76fe29e 100644 --- a/lib/ldap_migration/__init__.py +++ b/lib/ldap_migration/__init__.py @@ -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() -- 2.39.5