From 3e46def911df8d843206139eeed9ffc0c0a2ab36 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 18 Oct 2022 10:47:02 +0200 Subject: [PATCH] Making the linter happy, somehow. --- lib/pp_admintools/__init__.py | 3 +-- lib/pp_admintools/app/__init__.py | 12 ++---------- lib/pp_admintools/app/dns_deploy_zones.py | 3 +-- lib/pp_admintools/app/ldap.py | 3 ++- lib/pp_admintools/app/pdns.py | 4 +--- lib/pp_admintools/app/remove_ldap_user.py | 3 +-- lib/pp_admintools/app/set_ldap_password.py | 20 ++++++++++++-------- lib/pp_admintools/argparse_actions.py | 4 ++-- lib/pp_admintools/config/ldap.py | 7 +++---- lib/pp_admintools/config/pdns.py | 6 +++--- locale/de_DE/LC_MESSAGES/pp_admintools.po | 2 +- 11 files changed, 29 insertions(+), 38 deletions(-) diff --git a/lib/pp_admintools/__init__.py b/lib/pp_admintools/__init__.py index d483487..cb18c7c 100644 --- a/lib/pp_admintools/__init__.py +++ b/lib/pp_admintools/__init__.py @@ -1,10 +1,9 @@ #!/bin/env python3 # -*- coding: utf-8 -*- -__version__ = '0.5.0' +__version__ = '0.5.1' MAX_PORT_NUMBER = (2 ** 16) - 1 -MAX_TIMEOUT = 3600 DEFAULT_CONFIG_DIR = 'pixelpark' # vim: ts=4 et list diff --git a/lib/pp_admintools/app/__init__.py b/lib/pp_admintools/app/__init__.py index 0baed8a..fa23a62 100644 --- a/lib/pp_admintools/app/__init__.py +++ b/lib/pp_admintools/app/__init__.py @@ -9,24 +9,16 @@ from __future__ import absolute_import # Standard modules import logging -import argparse -import signal -import re -import getpass # Third party modules -from fb_tools.common import to_bool -from fb_tools.argparse_actions import TimeoutOptionAction from fb_tools.cfg_app import FbConfigApplication -from fb_tools.errors import FbAppError, IoTimeoutError, TimeoutOnPromptError +from fb_tools.errors import FbAppError from fb_tools.multi_config import BaseMultiConfig # Own modules from .. import __version__ as GLOBAL_VERSION from .. import DEFAULT_CONFIG_DIR -from ..config.ldap import MAX_TIMEOUT - from ..xlate import XLATOR LOG = logging.getLogger(__name__) @@ -34,7 +26,7 @@ LOG = logging.getLogger(__name__) _ = XLATOR.gettext ngettext = XLATOR.ngettext -__version__ = '0.4.1' +__version__ = '0.4.2' # ============================================================================= diff --git a/lib/pp_admintools/app/dns_deploy_zones.py b/lib/pp_admintools/app/dns_deploy_zones.py index c9e811e..0cf7aeb 100644 --- a/lib/pp_admintools/app/dns_deploy_zones.py +++ b/lib/pp_admintools/app/dns_deploy_zones.py @@ -44,7 +44,7 @@ from ..config.dns_deploy_zones import DnsDeployZonesConfig from ..xlate import XLATOR -__version__ = '0.8.4' +__version__ = '0.8.5' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -261,7 +261,6 @@ class PpDeployZonesApp(PpPDNSApplication): deploy_group = self.arg_parser.add_argument_group(_("Options for {}").format( self.appname)) - deploy_group.add_argument( '-B', '--backup', dest="keep_backup", action='store_true', help=_("Keep a backup file for each changed configuration file."), diff --git a/lib/pp_admintools/app/ldap.py b/lib/pp_admintools/app/ldap.py index e313175..470cbb5 100644 --- a/lib/pp_admintools/app/ldap.py +++ b/lib/pp_admintools/app/ldap.py @@ -31,6 +31,7 @@ from ldap3.core.exceptions import LDAPException # from ldap3.core.exceptions import LDAPException, LDAPBindError from fb_tools.common import pp, is_sequence, to_bool +from fb_tools.argparse_actions import TimeoutOptionAction from fb_tools.mailaddress import MailAddress from fb_tools.collections import FrozenCIStringSet, CIStringSet, CIDict @@ -43,7 +44,7 @@ from .. import MAX_PORT_NUMBER, DEFAULT_CONFIG_DIR # from ..argparse_actions import PortOptionAction -from . import DPXAppError, TimeoutOptionAction, BaseDPXApplication +from . import DPXAppError, BaseDPXApplication # from ..config.ldap import LdapConfigError from ..config.ldap import LdapConnectionInfo, LdapConfiguration diff --git a/lib/pp_admintools/app/pdns.py b/lib/pp_admintools/app/pdns.py index df73747..16bb693 100644 --- a/lib/pp_admintools/app/pdns.py +++ b/lib/pp_admintools/app/pdns.py @@ -22,7 +22,6 @@ import psutil # Own modules from fb_tools.common import pp -from fb_tools.argparse_actions import TimeoutOptionAction from fb_tools.xlate import format_list from fb_pdnstools.zone import PowerDNSZone @@ -41,7 +40,7 @@ from ..config.pdns import PdnsConfiguration from ..xlate import XLATOR -__version__ = '0.9.4' +__version__ = '0.9.5' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -241,7 +240,6 @@ class PpPDNSApplication(BaseMailApplication): insts = PdnsConfiguration.valid_pdns_api_instances inst_list = format_list(insts, do_repr=True) - default_timeout = PdnsConfiguration.default_pdns_timeout inst_group.add_argument( '-I', '--inst', '--instance', diff --git a/lib/pp_admintools/app/remove_ldap_user.py b/lib/pp_admintools/app/remove_ldap_user.py index 37e29e1..68a1b66 100644 --- a/lib/pp_admintools/app/remove_ldap_user.py +++ b/lib/pp_admintools/app/remove_ldap_user.py @@ -17,11 +17,10 @@ from ldap3 import MODIFY_REPLACE, MODIFY_ADD, MODIFY_DELETE # Own modules from fb_tools.common import to_bool, is_sequence, pp +from fb_tools.errors import AbortAppError, TimeoutOnPromptError from ..xlate import XLATOR -from . import AbortAppError, TimeoutOnPromptError - from .ldap import LdapAppError, FatalLDAPError from .ldap import BaseLdapApplication diff --git a/lib/pp_admintools/app/set_ldap_password.py b/lib/pp_admintools/app/set_ldap_password.py index 06db877..0b2009a 100644 --- a/lib/pp_admintools/app/set_ldap_password.py +++ b/lib/pp_admintools/app/set_ldap_password.py @@ -36,7 +36,7 @@ from .ldap import LdapAppError, FatalLDAPError from .ldap import BaseLdapApplication from .ldap import PasswordFileOptionAction -__version__ = '0.6.2' +__version__ = '0.6.3' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -242,14 +242,18 @@ class SetLdapPasswordApplication(BaseLdapApplication): def_schema = schema_id schema_list.append('list') + help_txt1 = _( + "The schema (hashing method) to use to hash the new password. It is possible to give " + "here the value {val_list!r}, then all possible schemes are shown and exit. " + "Default: {default!r}.").format(val_list='list', default=def_schema) + + help_txt2 = _( + "If you are not using an admin account, then the password will hashed " + "only by the default schema.") + app_group.add_argument( '-S', '--schema', metavar=_("SCHEMA"), dest="schema", choices=schema_list, - help=_( - "The schema (hashing method) to use to hash the new password. " - "It is possible to give here the value {val_list!r}, then all possible schemes " - "are shown and exit. Default: {default!r}.").format( - val_list='list', default=def_schema) + ' ' + _("If you are not using an " - "admin account, then the password will hashed only by the default schema.") + help=(help_txt1 + ' ' + help_txt2) ) user_help = _( @@ -599,7 +603,7 @@ class SetLdapPasswordApplication(BaseLdapApplication): changes['userPassword'] = [(MODIFY_REPLACE, hashed_passwd)] inst = self.ldap_instances[0] - connect_info = self.cfg.ldap_connection[inst] + # connect_info = self.cfg.ldap_connection[inst] msg = _("Setting password ...") LOG.info(msg) diff --git a/lib/pp_admintools/argparse_actions.py b/lib/pp_admintools/argparse_actions.py index 314a999..2604324 100644 --- a/lib/pp_admintools/argparse_actions.py +++ b/lib/pp_admintools/argparse_actions.py @@ -12,11 +12,11 @@ import logging import argparse # Own modules -from . import MAX_PORT_NUMBER, MAX_TIMEOUT +from . import MAX_PORT_NUMBER from .xlate import XLATOR -__version__ = '0.2.1' +__version__ = '0.2.2' LOG = logging.getLogger(__name__) _ = XLATOR.gettext diff --git a/lib/pp_admintools/config/ldap.py b/lib/pp_admintools/config/ldap.py index f790235..50bd968 100644 --- a/lib/pp_admintools/config/ldap.py +++ b/lib/pp_admintools/config/ldap.py @@ -17,11 +17,11 @@ import re # Third party modules # Own modules + +from fb_tools import MAX_TIMEOUT # from fb_tools.common import pp from fb_tools.common import is_sequence, to_bool - from fb_tools.multi_config import DEFAULT_ENCODING - from fb_tools.obj import FbGenericBaseObject, FbBaseObject from . import PpConfigurationError, PpBaseConfiguration @@ -32,7 +32,7 @@ from . import VALID_TIERS, DEFAULT_TIER from ..xlate import XLATOR -__version__ = '0.4.1' +__version__ = '0.4.2' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -40,7 +40,6 @@ _ = XLATOR.gettext DEFAULT_PORT_LDAP = 389 DEFAULT_PORT_LDAPS = 636 DEFAULT_TIMEOUT = 20 -MAX_TIMEOUT = 3600 # ============================================================================= class LdapConfigError(PpConfigurationError): diff --git a/lib/pp_admintools/config/pdns.py b/lib/pp_admintools/config/pdns.py index 31e97c7..b4c0260 100644 --- a/lib/pp_admintools/config/pdns.py +++ b/lib/pp_admintools/config/pdns.py @@ -19,13 +19,13 @@ import copy # Own modules +from fb_tools import MAX_TIMEOUT from fb_tools.common import is_sequence, pp - # from .config import ConfigError, BaseConfiguration from fb_tools.multi_config import DEFAULT_ENCODING from .. import __version__ as GLOBAL_VERSION -from .. import MAX_TIMEOUT, MAX_PORT_NUMBER +from .. import MAX_PORT_NUMBER from .mail import MailConfigError, MailConfiguration from .mail import DEFAULT_CONFIG_DIR @@ -34,7 +34,7 @@ from ..xlate import XLATOR LIBRARY_NAME = "pp-pdns-api-client" -__version__ = '0.2.3' +__version__ = '0.2.4' LOG = logging.getLogger(__name__) _ = XLATOR.gettext diff --git a/locale/de_DE/LC_MESSAGES/pp_admintools.po b/locale/de_DE/LC_MESSAGES/pp_admintools.po index 7c644e3..d47cb14 100644 --- a/locale/de_DE/LC_MESSAGES/pp_admintools.po +++ b/locale/de_DE/LC_MESSAGES/pp_admintools.po @@ -1135,7 +1135,7 @@ msgid "" " somehow the current password of the user to change." msgstr "" "Wenn eine LDAP-Instanz verwendet wird, die nur Leserechte oder keinen Admin-Zugriff hat, dann " -"mussirgendwie das neue Passwort des Nutzer zum Ändern angegeben werden." +"muss irgendwie das neue Passwort des Nutzer zum Ändern angegeben werden." #: lib/pp_admintools/app/set_ldap_password.py:316 msgid "Could not detect your current login name." -- 2.39.5