]> Frank Brehm's Git Trees - pixelpark/admin-tools.git/commitdiff
Returning to Python3, Bugfixing in pp_lib/ldap_app.py
authorFrank Brehm <frank.brehm@pixelpark.com>
Tue, 4 Jul 2017 08:46:53 +0000 (10:46 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Tue, 4 Jul 2017 08:46:53 +0000 (10:46 +0200)
mk-home
pp_lib/ldap_app.py
quota-check
test-home

diff --git a/mk-home b/mk-home
index c5e9e2559738b236b752bd50634f2c7ea852cc79..dec4def6db15bf02d65d2301ff0ffc23622b5310 100755 (executable)
--- a/mk-home
+++ b/mk-home
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # Standard modules
 import sys
index d8964a9db286e898d4e681b8cca8276bfd44bacd..91c655dce3ca14891a7c89699aae1ebfcdecd19b 100644 (file)
@@ -26,7 +26,7 @@ import ldap3
 # ldap3 classes and objects
 from ldap3 import Server, ServerPool, Connection, Reader, Writer, ObjectDef
 # ldap3 constants
-from ldap3 import IP_V4_PREFERRED, ROUND_ROBIN, AUTO_BIND_NONE, ALL_ATTRIBUTES
+from ldap3 import IP_V4_ONLY, IP_V4_PREFERRED, ROUND_ROBIN, AUTO_BIND_NONE, ALL_ATTRIBUTES
 from ldap3 import SUBTREE
 
 from ldap3.core.exceptions import LDAPPasswordIsMandatoryError
@@ -126,13 +126,13 @@ class PpLdapApplication(PpConfigApplication):
             cfg_encoding=cfg_encoding, need_config_file=need_config_file,
         )
 
-        if self.verbose > 3:
+        if self.verbose > 5:
             set_library_log_detail_level(EXTENDED)
-        elif self.verbose > 2:
+        elif self.verbose > 4:
             set_library_log_detail_level(NETWORK)
-        elif self.verbose > 1:
+        elif self.verbose > 3:
             set_library_log_detail_level(PROTOCOL)
-        elif self.verbose:
+        elif self.verbose > 2:
             set_library_log_detail_level(BASIC)
         else:
             set_library_log_detail_level(ERROR)
@@ -212,13 +212,11 @@ class PpLdapApplication(PpConfigApplication):
                 mode=IP_V4_PREFERRED, connect_timeout=self.ldap_timeout)
 
         # Init LDAP Server objects
-        if len(self.ldap_hosts) > 1:
+        if len(self.ldap_hosts):
             self.ldap_server = ServerPool(None, ROUND_ROBIN)
             for h in self.ldap_hosts:
                 server = _get_ldap_server(h)
                 self.ldap_server.add(server)
-        elif len(self.ldap_hosts) == 1:
-            self.ldap_server = _get_ldap_server(self.ldap_hosts[0])
         else:
             msg = "No LDAP servers found in configuration."
             raise PpLdapAppError(msg)
index af4613042cb39c00af2602765465eb4cfdc23d1c..35a0ad1fe64697985060ba49f700403a4056ef85 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 
 from __future__ import print_function
index fd233282bdcd08e99ccf868b78f3d428017e150a..32eb03e89cc40cb35c51119013e8f4c4a7333a08 100755 (executable)
--- a/test-home
+++ b/test-home
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # Standard modules
 import sys