From: Frank Brehm Date: Fri, 4 Dec 2020 15:50:42 +0000 (+0100) Subject: Display of not migrated items X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=0bc446653ef72e1c858cffd8f17f882e2253c943;p=pixelpark%2Fldap-migration.git Display of not migrated items --- diff --git a/lib/ldap_migration/__init__.py b/lib/ldap_migration/__init__.py index 830b022..756d030 100644 --- a/lib/ldap_migration/__init__.py +++ b/lib/ldap_migration/__init__.py @@ -45,7 +45,7 @@ from .config import LDAPMigrationConfiguration from .idict import CaseInsensitiveDict from .istringset import CaseInsensitiveStringSet -__version__ = '0.8.4' +__version__ = '0.8.5' LOG = logging.getLogger(__name__) CFG_BASENAME = 'ldap-migration.ini' @@ -215,6 +215,7 @@ class LDAPMigrationApplication(BaseApplication): self.struct_dns = CaseInsensitiveDict() self.migrated_entries = CaseInsensitiveDict() self.integer_attribute_types = CaseInsensitiveStringSet([]) + self.src_items_not_found = CaseInsensitiveStringSet([]) super(LDAPMigrationApplication, self).__init__( appname=appname, verbose=verbose, version=version, base_dir=base_dir, @@ -1115,6 +1116,8 @@ class LDAPMigrationApplication(BaseApplication): except ReadLDAPItemError as e: msg = "Could not get source item: " + str(e) LOG.error(msg) + self.write_result_file(fh, src_dn, '!') + self.src_items_not_found.add(src_dn) continue print() @@ -1463,11 +1466,18 @@ class LDAPMigrationApplication(BaseApplication): self.get_structural_dns() self.migrate_entries() if self.verbose > 1: - mlist = [] + print() + print(self.colored('Migrated items:', 'GREEN')) + print(self.colored('###############', 'GREEN')) for key in self.migrated_entries: - dn = self.migrated_entries[key] - mlist.append(dn) - LOG.debug("Migrated items:\n{}".format(pp(mlist))) + print(self.colored(' * {!r}'.format(key), 'GREEN')) + if len(self.src_items_not_found): + print() + print(self.colored('Not migrated items:', 'CYAN')) + print(self.colored('###################', 'CYAN')) + for dn in self.src_items_not_found: + print(self.colored(' * {!r}'.format(dn), 'CYAN')) + finally: self.disconnect()