# Standard modules
import logging
-import copy
-import pipes
import os
import argparse
except ImportError:
from pathlib2 import Path
-## Third party modules
-from fb_tools.common import pp
-
+# Third party modules
from fb_tools.cfg_app import FbConfigApplication
from fb_tools.errors import FbAppError
from . import MAX_PORT_NUMBER, DEFAULT_CONFIG_DIR
-from .xlate import XLATOR
-
-from .argparse_actions import PortOptionAction
+# from .argparse_actions import PortOptionAction
-from .ldap_config import LdapConfigError, LdapConnectionInfo, LdapConfiguration
-from .ldap_config import DEFAULT_PORT_LDAP, DEFAULT_PORT_LDAPS, DEFAULT_TIMEOUT, MAX_TIMEOUT
+# from .ldap_config import LdapConfigError
+from .ldap_config import LdapConnectionInfo, LdapConfiguration
+# rom .ldap_config import DEFAULT_PORT_LDAP, DEFAULT_PORT_LDAPS
+from .ldap_config import DEFAULT_TIMEOUT, MAX_TIMEOUT
-__version__ = '0.1.1'
+__version__ = '0.1.2'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
class PasswordFileOptionAction(argparse.Action):
# -------------------------------------------------------------------------
- def __init__(self, option_strings, must_exists=True, *args, **kwargs):
+ def __init__(self, option_strings, must_exists=True, *args, **kwargs):
self.must_exists = bool(must_exists)
def __call__(self, parser, namespace, given_port, option_string=None):
try:
- port = int(given_port):
+ port = int(given_port)
if port <= 0 or port > MAX_PORT_NUMBER:
msg = _(
"a port number must be greater than zero and less "
def __call__(self, parser, namespace, given_timeout, option_string=None):
try:
- timeout = int(given_timeout):
+ timeout = int(given_timeout)
if timeout <= 0 or timeout > MAX_TIMEOUT:
msg = _(
"a timeout must be greater than zero and less "
return res
-
# -------------------------------------------------------------------------
def init_arg_parser(self):
"""
ldap_group.add_argument(
'--ssl', '--ldaps', '--ldap-ssl', dest="ldap_ssl", action="store_true",
- help=_("Use ldaps to connect to the LDAP server. Default: {}").format(ldap_ssl_str),
+ help=_("Use ldaps to connect to the LDAP server. Default: {}").format(
+ ldap_ssl_str),
)
ldap_group.add_argument(
# Third party modules
# Own modules
-
-from fb_tools.common import is_sequence, pp, to_bool
+# from fb_tools.common import pp
+from fb_tools.common import is_sequence, to_bool
# from .config import ConfigError, BaseConfiguration
from fb_tools.multi_config import MultiConfigError, BaseMultiConfig
from fb_tools.obj import FbGenericBaseObject, FbBaseObject
-from . import __version__ as GLOBAL_VERSION
from . import MAX_PORT_NUMBER, DEFAULT_CONFIG_DIR
from .xlate import XLATOR
-__version__ = '0.2.2'
+__version__ = '0.2.3'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
def __copy__(self):
new = self.__class__(
- appname=appname, verbose=verbose, base_dir=base_dir, host=host, use_ldaps=use_ldaps,
- port=port, base_dn=base_dn, bind_dn=bind_dn, bind_pw=bind_pw,
- initialized=initialized)
+ appname=self.appname, verbose=self.verbose, base_dir=self.base_dir, host=self.host,
+ use_ldaps=self.use_ldaps, port=self.port, base_dn=self.base_dn, bind_dn=self.bind_dn,
+ bind_pw=self.bind_pw, initialized=self.initialized)
return new
def _eval_ldap_timeout(self, value):
timeout = DEFAULT_TIMEOUT
+ msg_invalid = _("Value {!r} for a timeout is invalid.")
try:
timeout = int(value)
except (ValueError, TypeError) as e:
- msg = _("Value {!r} for a timeout is invalid:").format(value)
- msg += ' ' + str(e)
+ msg = msg_invalid.format(value)
+ msg += ': ' + str(e)
LOG.error(msg)
return
if timeout <= 0 or timeout > MAX_TIMEOUT:
- msg = _("Value {!r} for a timeout is invalid:").format(value)
- msg += ' ' + str(e)
+ msg = msg_invalid.format(value)
LOG.error(msg)
return
continue
if port <= 0 or port > MAX_PORT_NUMBER:
msg = msg_invalid.format(val=value, sec=section_name, what='port')
- msg += ' ' + str(e)
LOG.error(msg)
continue
connection.port = port