]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Changing display of progress in lib/pp_admintools/app/mirror_ldap.py
authorFrank Brehm <frank.brehm@pixelpark.com>
Fri, 2 Feb 2024 10:15:41 +0000 (11:15 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Fri, 2 Feb 2024 10:15:41 +0000 (11:15 +0100)
lib/pp_admintools/app/mirror_ldap.py

index 423230dc3087b113203ddf3adc3f15b439ad93af..ce220e612df9463d8d489d24d6efa9a3679e1706 100644 (file)
@@ -36,7 +36,7 @@ from ..errors import DpxLdapReadError
 from ..errors import DpxLdapSessionError
 from ..xlate import XLATOR
 
-__version__ = '1.2.2'
+__version__ = '1.2.3'
 LOG = logging.getLogger(__name__)
 
 _ = XLATOR.gettext
@@ -515,6 +515,9 @@ class MirrorLdapApplication(BaseLdapApplication):
         self.empty_line()
         self.line(color='CYAN')
         LOG.info(_('Removing non structural entries from target LDAP instance.'))
+        total = len(self.tgt_dns_current)
+        msg = ngettext('Evaluating one entry.', 'Evaluating {no} entries.', total).format(no=total)
+        LOG.debug(msg)
         if not self.quiet:
             time.sleep(2)
         self.empty_line()
@@ -555,8 +558,8 @@ class MirrorLdapApplication(BaseLdapApplication):
             if self.wait_after_write and not self.simulate:
                 time.sleep(self.wait_after_write)
 
+        self.empty_line()
         if count:
-            self.empty_line()
             msg = ngettext(
                 'Removed one not structural entry in target LDAP instance.',
                 'Removed {no} not structural entries in target LDAP instance.',
@@ -577,6 +580,9 @@ class MirrorLdapApplication(BaseLdapApplication):
         self.empty_line()
         self.line(color='CYAN')
         LOG.info(_('Removing structural entries from target LDAP instance.'))
+        total = len(self.tgt_struct_dns_current)
+        msg = ngettext('Evaluating one entry.', 'Evaluating {no} entries.', total).format(no=total)
+        LOG.debug(msg)
         if not self.quiet:
             time.sleep(2)
         self.empty_line()
@@ -616,8 +622,8 @@ class MirrorLdapApplication(BaseLdapApplication):
             if self.wait_after_write and not self.simulate:
                 time.sleep(self.wait_after_write)
 
+        self.empty_line()
         if count:
-            self.empty_line()
             msg = ngettext(
                 'Removed one structural entry in target LDAP instance.',
                 'Removed {no} structural entries in target LDAP instance.',
@@ -632,6 +638,9 @@ class MirrorLdapApplication(BaseLdapApplication):
         self.empty_line()
         self.line(color='CYAN')
         LOG.info(_('Mirroring structural entries from source to target LDAP instance.'))
+        total = len(self.src_struct_dns)
+        msg = ngettext('Evaluating one entry.', 'Evaluating {no} entries.', total).format(no=total)
+        LOG.debug(msg)
         if not self.quiet:
             time.sleep(2)
 
@@ -787,10 +796,11 @@ class MirrorLdapApplication(BaseLdapApplication):
         if modified and self.verbose:
             if self.verbose == 1:
                 self.empty_line()
-            msg = _('Modifying source data for {!r} ...').format(dn)
-            LOG.info(msg)
-            LOG.debug('Unmodified data:\n' + pp(unmodified_data))
-            LOG.debug('Modified data:\n' + pp(src_attribs.dict()))
+            if self.verbose > 1:
+                msg = _('Modifying source data for {!r} ...').format(dn)
+                LOG.info(msg)
+                LOG.debug('Unmodified data:\n' + pp(unmodified_data))
+                LOG.debug('Modified data:\n' + pp(src_attribs.dict()))
 
         return modified
 
@@ -921,6 +931,9 @@ class MirrorLdapApplication(BaseLdapApplication):
         self.empty_line()
         self.line(color='CYAN')
         LOG.info(_('Mirroring non-structural entries from source to target LDAP instance.'))
+        total = len(self.src_dns)
+        msg = ngettext('Evaluating one entry.', 'Evaluating {no} entries.', total).format(no=total)
+        LOG.debug(msg)
         if not self.quiet:
             time.sleep(2)
 
@@ -958,6 +971,9 @@ class MirrorLdapApplication(BaseLdapApplication):
 
         self.line(color='CYAN')
         LOG.info(_('Mirroring members in group entries from source to target LDAP instance.'))
+        total = len(self.src_dns)
+        msg = ngettext('Evaluating one entry.', 'Evaluating {no} entries.', total).format(no=total)
+        LOG.debug(msg)
         if not self.quiet:
             time.sleep(2)