From: Frank Brehm Date: Wed, 7 Sep 2022 12:44:19 +0000 (+0200) Subject: Minor changes X-Git-Tag: 0.5.0^2~2^2~10 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=b4a566b91b219f8c9e39b106327d77c48a4660ed;p=pixelpark%2Fpp-admin-tools.git Minor changes --- diff --git a/lib/pp_admintools/app/ldap.py b/lib/pp_admintools/app/ldap.py index 12c3219..9490690 100644 --- a/lib/pp_admintools/app/ldap.py +++ b/lib/pp_admintools/app/ldap.py @@ -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] # ------------------------------------------------------------------------- diff --git a/lib/pp_admintools/app/remove_ldap_user.py b/lib/pp_admintools/app/remove_ldap_user.py index f593e50..c69c8bc 100644 --- a/lib/pp_admintools/app/remove_ldap_user.py +++ b/lib/pp_admintools/app/remove_ldap_user.py @@ -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):