]> Frank Brehm's Git Trees - pixelpark/ldap-migration.git/commitdiff
Output changes
authorFrank Brehm <frank.brehm@pixelpark.com>
Fri, 8 Jan 2021 11:51:17 +0000 (12:51 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Fri, 8 Jan 2021 11:51:17 +0000 (12:51 +0100)
lib/ldap_migration/__init__.py

index 25880da91b897da3668bc36e8aa405dcf7222d4d..8513f50d602d736ea1a3056fb99560139a8e91ed 100644 (file)
@@ -45,7 +45,7 @@ from fb_tools.collections import CIStringSet, CIDict
 
 from .config import LDAPMigrationConfiguration
 
-__version__ = '0.10.0'
+__version__ = '0.10.1'
 
 LOG = logging.getLogger(__name__)
 CFG_BASENAME = 'ldap-migration.ini'
@@ -1879,11 +1879,11 @@ class LDAPMigrationApplication(BaseApplication):
                         'src_dn': src_dn,
                         'object_classes': self.group_entries[tgt_dn]['object_classes'],
                     }
-                    LOG.info("Group entry {src!} -> {tgt!r} successful migrated.".format(
+                    LOG.info("Group entry {src!r} -> {tgt!r} successful migrated.".format(
                         src=src_dn, tgt=tgt_dn))
                 else:
                     LOG.info((
-                        "Group entry {src!} -> {tgt!r} could not migrated "
+                        "Group entry {src!r} -> {tgt!r} could not migrated "
                         "in lap {lap}.").format(src=src_dn, tgt=tgt_dn, lap=lap))
 
             for tgt_dn in migrated_dns:
@@ -1918,19 +1918,19 @@ class LDAPMigrationApplication(BaseApplication):
     # -------------------------------------------------------------------------
     def detailled_summary(self):
 
-        if self.verbose > 1:
-            print()
-            print(self.colored('Migrated items:', 'GREEN'))
-            print(self.colored('###############', 'GREEN'))
-            for key in self.migrated_entries:
-                print(self.colored(' * {!r}'.format(key), 'GREEN'))
+        if self.verbose:
             if len(self.src_items_not_found):
                 print()
-                print(self.colored('Not migrated items:', 'AQUA'))
-                print(self.colored('###################', 'AQUA'))
+                print(self.colored('Not migrated entries:', 'AQUA'))
+                print(self.colored('#####################', 'AQUA'))
                 for dn in self.src_items_not_found:
                     print(self.colored(' * {!r}'.format(dn), 'AQUA'))
-        if self.verbose:
+            if len(self.group_entries):
+                print()
+                print(self.colored('Not migrated group entries:', 'AQUA'))
+                print(self.colored('###########################', 'AQUA'))
+                for dn in self.group_entries:
+                    print(self.colored(' * {!r}'.format(dn), 'AQUA'))
             if len(self.unknown_attributetypes):
                 print()
                 print(self.colored('Unknown and not migrated Attribute Types:', 'AQUA'))
@@ -1947,21 +1947,30 @@ class LDAPMigrationApplication(BaseApplication):
     # -------------------------------------------------------------------------
     def summary(self):
 
-        count_groups = 0
-        if self.group_entries:
-            count_groups = len(self.group_entries)
-
+        count_groups = len(self.group_entries)
+        count_migrated_groups = len(self.migrated_group_entries)
         count_ignored = len(self.ignored_entries)
 
         print()
         total = self.count_unchanged + self.count_added + self.count_modified
-        total += count_groups + count_ignored
+        total += count_groups + count_migrated_groups + count_ignored
+        print()
+        print(self.colored('Performed entries:', 'GREEN'))
+        print(self.colored('##################', 'GREEN'))
+        print(self.colored(' * {:>5} total'.format(total), 'GREEN'))
+        print(self.colored(' * {:>5} added'.format(self.count_added), 'GREEN'))
+        print(self.colored(' * {:>5} modified'.format(self.count_modified), 'GREEN'))
+        print(self.colored(' * {:>5} unchanged'.format(self.count_unchanged), 'GREEN'))
+        print(self.colored(' * {:>5} migrated groups'.format(count_migrated_groups), 'GREEN'))
+        print(self.colored(' * {:>5} ignored groups'.format(count_groups), 'CYAN'))
+        print(self.colored(' * {:>5} ignored entries'.format(count_ignored), 'CYAN'))
         msg = (
             "Performed all entries: {to} total, {ad} added, {mo} modified, "
-            "{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, ig=count_ignored)
-        LOG.info(msg)
+            "{un} unchanged, {mg} migrated groups, {g} ignored groups, "
+            "{ig} ignored items.").format(
+                to=total, ad=self.count_added, mo=self.count_modified, un=self.count_unchanged,
+                mg=count_migrated_groups, g=count_groups, ig=count_ignored)
+        LOG.debug(msg)
         print()
 
     # -------------------------------------------------------------------------