from __future__ import absolute_import
# Standard modules
-import sys
-import os
import logging
import logging.config
import re
-import traceback
-import textwrap
import copy
# Third party modules
-import six
-
-import ldap3
# ldap3 classes and objects
from ldap3 import Server, ServerPool, Connection, Reader, Writer, ObjectDef
from ldap3.core.exceptions import LDAPPasswordIsMandatoryError
# Own modules
-from .global_version import __version__ as __global_version__
-
-from .errors import FunctionNotImplementedError, PpAppError
-
-from .common import pp, terminal_can_colors, to_bytes, to_bool
-
-from .merge import merge_structure
+from .common import pp, to_bool
from .cfg_app import PpCfgAppError, PpConfigApplication
-__version__ = '0.4.5'
+__version__ = '0.4.6'
LOG = logging.getLogger(__name__)
stems.append(s)
else:
stems = self.appname
- if not 'ldap' in stems:
+ if 'ldap' not in stems:
stems.insert(0, 'ldap')
super(PpLdapApplication, self).__init__(
LOG.debug("Evaluating config section {n!r}:\n{s}".format(
n=section_name, s=pp(ldap_section)))
-
if 'host' in ldap_section:
hosts = self.fs_re.split(ldap_section['host'])
for host in hosts:
if 'port' in ldap_section:
try:
port = int(ldap_section['port'])
- except (ValueError, TypeError) as e:
+ except (ValueError, TypeError):
msg = "Invalid LDAP port ({s}/port => {v!r}) found in configuration.".format(
s=section_name, v=ldap_section['port'])
raise PpLdapAppError(msg)
if 'timeout' in ldap_section:
try:
timeout = int(ldap_section['timeout'])
- except (ValueError, TypeError) as e:
- msg = "Invalid LDAP timeout ({s}/port => {v!r}) found in configuration.".format(
+ except (ValueError, TypeError):
+ msg = (
+ "Invalid LDAP timeout ({s}/port => {v!r}) found in configuration.").format(
s=section_name, v=ldap_section['timeout'])
LOG.error(msg)
if timeout > 0:
if not read_cursor.entries:
msg = "Did not found Counter LDAP entry {!r}.".format(dn)
- raise PpMkHomeError(msg)
+ raise PpLdapAppError(msg)
entry = read_cursor.entries[0]
if self.verbose: