[sysadmin-bin] Attempt reconnecting in case of LDAP server going into maintenance/downtime
- From: Andrea Veri <averi src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] Attempt reconnecting in case of LDAP server going into maintenance/downtime
- Date: Tue, 11 May 2021 14:47:19 +0000 (UTC)
commit 90e92daa846d9bb28c8405717234e0fb67b75c70
Author: Andrea Veri <averi redhat com>
Date: Tue May 11 16:46:57 2021 +0200
Attempt reconnecting in case of LDAP server going into maintenance/downtime
gnome_ldap_utils.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gnome_ldap_utils.py b/gnome_ldap_utils.py
index 2f0bb26..7485d8a 100755
--- a/gnome_ldap_utils.py
+++ b/gnome_ldap_utils.py
@@ -19,8 +19,12 @@ class Gnome_ldap_utils:
self.conn = ldap.initialize("ldaps://%s:636" % self.LDAP_HOST)
self.conn.simple_bind_s(self.LDAP_USER, self.LDAP_PASSWORD)
except ldap.LDAPError as e:
- print(e, file=sys.stderr)
- sys.exit(1)
+ 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)
def get_group_from_ldap(self, group):
import ldap.filter
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]