from .config import LDAPMigrationConfiguration
-__version__ = '0.9.7'
+__version__ = '0.9.8'
LOG = logging.getLogger(__name__)
CFG_BASENAME = 'ldap-migration.ini'
msg += "\n" + '\n'.join(map(lambda x: ' * {!r}'.format(x), self.group_entries.keys()))
LOG.info(msg)
- print()
- total = self.count_unchanged + self.count_added + self.count_modified + count_groups
- msg = (
- "Performed all entries: {to} total, {ad} added, {mo} modified, "
- "{un} unchanged, {g} ignored groups.").format(
- to=total, ad=self.count_added, mo=self.count_modified,
- un=self.count_unchanged, g=count_groups)
- LOG.info(msg)
-
+ LOG.info("Performed all entries.")
time.sleep(3)
return True
return False
+ # -------------------------------------------------------------------------
+ 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 len(self.src_items_not_found):
+ print()
+ print(self.colored('Not migrated items:', '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.unknown_attributetypes):
+ print()
+ print(self.colored('Unknown and not migrated Attribute Types:', 'AQUA'))
+ print(self.colored('#########################################', 'AQUA'))
+ for at in self.unknown_attributetypes:
+ print(self.colored(' * {!r}'.format(at), 'AQUA'))
+ if len(self.unknown_objectclasses):
+ print()
+ print(self.colored('Unknown and not migrated Object Classes:', 'AQUA'))
+ print(self.colored('########################################', 'AQUA'))
+ for oc in self.unknown_objectclasses:
+ print(self.colored(' * {!r}'.format(oc), 'AQUA'))
+
+ # -------------------------------------------------------------------------
+ def summary(self):
+
+ count_groups = 0
+ if self.group_entries:
+ count_groups = len(self.group_entries)
+
+ print()
+ total = self.count_unchanged + self.count_added + self.count_modified + count_groups
+ msg = (
+ "Performed all entries: {to} total, {ad} added, {mo} modified, "
+ "{un} unchanged, {g} ignored groups.").format(
+ to=total, ad=self.count_added, mo=self.count_modified,
+ un=self.count_unchanged, g=count_groups)
+ LOG.info(msg)
+ print()
+
# -------------------------------------------------------------------------
def _run(self):
self.get_all_dns()
self.get_structural_dns()
self.migrate_entries()
- 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 len(self.src_items_not_found):
- print()
- print(self.colored('Not migrated items:', '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.unknown_attributetypes):
- print()
- print(self.colored('Unknown and not migrated Attribute Types:', 'AQUA'))
- print(self.colored('#########################################', 'AQUA'))
- for at in self.unknown_attributetypes:
- print(self.colored(' * {!r}'.format(at), 'AQUA'))
- if len(self.unknown_objectclasses):
- print()
- print(self.colored('Unknown and not migrated Object Classes:', 'AQUA'))
- print(self.colored('########################################', 'AQUA'))
- for oc in self.unknown_objectclasses:
- print(self.colored(' * {!r}'.format(oc), 'AQUA'))
+ self.detailled_summary()
finally:
self.disconnect()
+ self.summary()
LOG.info("Ending {a!r}.".format(
a=self.appname, v=self.version))
-
# =============================================================================
if __name__ == "__main__":