# ldap3 classes and objects
from ldap3 import Server, ServerPool, Connection, Reader, Writer, ObjectDef
# ldap3 constants
-from ldap3 import IP_V4_ONLY, IP_V4_PREFERRED, ROUND_ROBIN, AUTO_BIND_NONE, ALL_ATTRIBUTES
+from ldap3 import IP_V4_PREFERRED, ROUND_ROBIN, AUTO_BIND_NONE, ALL_ATTRIBUTES
from ldap3 import SUBTREE
from ldap3.core.exceptions import LDAPPasswordIsMandatoryError
from .cfg_app import PpCfgAppError, PpConfigApplication
-__version__ = '0.4.8'
+__version__ = '0.4.9'
LOG = logging.getLogger(__name__)
self.do_ldap_cfg(section_name, section)
# -------------------------------------------------------------------------
- def do_ldap_cfg(self, section_name, section):
-
- if self.verbose > 2:
- LOG.debug("Evaluating config section {n!r}:\n{s}".format(
- n=section_name, s=pp(section)))
-
- if self.verbose > 2:
- LOG.debug("Evaluating config section {n!r}:\n{s}".format(
- n=section_name, s=pp(section)))
+ def _ldap_cfg_host(self, section_name, section):
got_host = False
continue
self.ldap_hosts.append(host)
+ # -------------------------------------------------------------------------
+ def _ldap_cfg_port(self, section_name, section):
+
if 'port' in section:
try:
port = int(section['port'])
raise PpLdapAppError(msg)
self.ldap_port = port
+ # -------------------------------------------------------------------------
+ def _ldap_cfg_other(self, section_name, section):
+
if 'ssl' in section:
self.ldap_use_ssl = to_bool(section['ssl'])
if timeout > 0:
self.ldap_timeout = timeout
+ # -------------------------------------------------------------------------
+ def do_ldap_cfg(self, section_name, section):
+
+ if self.verbose > 2:
+ LOG.debug("Evaluating config section {n!r}:\n{s}".format(
+ n=section_name, s=pp(section)))
+
+ self._ldap_cfg_host(section_name, section)
+ self._ldap_cfg_port(section_name, section)
+ self._ldap_cfg_other(section_name, section)
+
# ----------------------
def _get_ldap_server(host):
return Server(