]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Minor changes
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 7 Sep 2022 12:44:19 +0000 (14:44 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 7 Sep 2022 12:44:19 +0000 (14:44 +0200)
lib/pp_admintools/app/ldap.py
lib/pp_admintools/app/remove_ldap_user.py

index 12c3219d627007b5634df99deae9ef87ab655f3b..94906900b3c4d0485646314422cc6a805119ad27 100644 (file)
@@ -49,7 +49,7 @@ from ..config.ldap import LdapConnectionInfo, LdapConfiguration
 # rom ..config.ldap import DEFAULT_PORT_LDAP, DEFAULT_PORT_LDAPS
 from ..config.ldap import DEFAULT_TIMEOUT, MAX_TIMEOUT
 
-__version__ = '0.4.1'
+__version__ = '0.4.2'
 LOG = logging.getLogger(__name__)
 
 _ = XLATOR.gettext
@@ -599,7 +599,7 @@ class BaseLdapApplication(FbConfigApplication):
     def disconnect_all(self):
 
         if len(self.ldap_connection) or len(self.ldap_server):
-            LOG.debug(_("Disconnecting all remaining LDAP instances ..."))
+            LOG.debug(_("Disconnecting from all remaining LDAP instances ..."))
 
             for inst in self.ldap_instances:
                 self.disconnect_instance(inst)
@@ -611,13 +611,15 @@ class BaseLdapApplication(FbConfigApplication):
 
         if inst in self.ldap_connection:
             ldap_connection = self.ldap_connection[inst]
-            LOG.debug(_("Unbinding from LDAP server {!r} ...").format(connect_info.url))
+            if self.verbose > 1:
+                LOG.debug(_("Unbinding from LDAP server {!r} ...").format(connect_info.url))
             ldap_connection.unbind()
             ldap_connection = None
             del self.ldap_connection[inst]
 
         if inst in self.ldap_server:
-            LOG.debug(_("Disconnecting from LDAP server {!r} ...").format(connect_info.url))
+            if self.verbose > 1:
+                LOG.debug(_("Disconnecting from LDAP server {!r} ...").format(connect_info.url))
             del self.ldap_server[inst]
 
     # -------------------------------------------------------------------------
index f593e5015261258a5da9a2c33df9fb6969929efa..c69c8bcd3ebb77969966cac6ddbb17757e3fdfd3 100644 (file)
@@ -20,7 +20,7 @@ from ..xlate import XLATOR
 from ..app.ldap import LdapAppError
 from ..app.ldap import BaseLdapApplication
 
-__version__ = '0.3.1'
+__version__ = '0.3.2'
 LOG = logging.getLogger(__name__)
 
 _ = XLATOR.gettext
@@ -153,9 +153,13 @@ class RemoveLdapUserApplication(BaseLdapApplication):
         if self.wrong_users:
             self.exit(5)
 
-        if self.verbose > 1:
-            msg = _("Evaluated DNs of user {!r}:").format(user)
-            LOG.debug(msg + ' ' + pp(self.dns))
+        if not self.dns:
+            msg = _("All given users were not found in any LDAP instance.")
+            LOG.warn(msg)
+            self.exit(1)
+
+        msg = _("Evaluated DNs to remove:")
+        LOG.debug(msg + '\n' + pp(self.dns))
 
     # -------------------------------------------------------------------------
     def eval_user_dns(self, user):