[sysadmin-bin] Use ReconnectLDAPObject rather than plain initialize
- From: Andrea Veri <averi src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] Use ReconnectLDAPObject rather than plain initialize
- Date: Tue, 11 May 2021 14:56:07 +0000 (UTC)
commit b98c846f212c5b939023baff319386ccdab37c66
Author: Andrea Veri <averi redhat com>
Date: Tue May 11 16:55:56 2021 +0200
Use ReconnectLDAPObject rather than plain initialize
gnome_ldap_utils.py | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/gnome_ldap_utils.py b/gnome_ldap_utils.py
index 7485d8a..4b0974a 100755
--- a/gnome_ldap_utils.py
+++ b/gnome_ldap_utils.py
@@ -16,15 +16,11 @@ class Gnome_ldap_utils:
try:
ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, self.LDAP_CA_PATH)
- self.conn = ldap.initialize("ldaps://%s:636" % self.LDAP_HOST)
+ self.conn = ldap.ReconnectLDAPObject("ldaps://%s:636" % self.LDAP_HOST)
self.conn.simple_bind_s(self.LDAP_USER, self.LDAP_PASSWORD)
except ldap.LDAPError as e:
- if e.errno == 11:
- self.conn = ldap.ReconnectLDAPObject("ldaps://%s:636" % self.LDAP_HOST,
- retry_max=10, retry_delay=3)
- else:
- print(e, file=sys.stderr)
- sys.exit(1)
+ print(e, file=sys.stderr)
+ sys.exit(1)
def get_group_from_ldap(self, group):
import ldap.filter
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]