From 9400ef7498ba2e21201151a8dbd78a552a9e56ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sun, 22 Dec 2019 12:14:29 +0100 Subject: [PATCH 1/2] Don't update LDAP if there are nothing to do --- moulinette/authenticators/ldap.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/moulinette/authenticators/ldap.py b/moulinette/authenticators/ldap.py index 3d27ad96..35b764c2 100644 --- a/moulinette/authenticators/ldap.py +++ b/moulinette/authenticators/ldap.py @@ -232,6 +232,9 @@ class Authenticator(BaseAuthenticator): actual_entry = self.search(base=dn, attrs=None) ldif = modlist.modifyModlist(actual_entry[0], attr_dict, ignore_oldexistent=1) + if ldif == []: + return True + try: if new_rdn: self.con.rename_s(dn, new_rdn) From 7ff033090c6ce0a140c7f208f1ed29c25b987148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Mon, 23 Dec 2019 10:56:25 +0100 Subject: [PATCH 2/2] Add warning when nothing is updated in LDAP --- moulinette/authenticators/ldap.py | 1 + 1 file changed, 1 insertion(+) diff --git a/moulinette/authenticators/ldap.py b/moulinette/authenticators/ldap.py index 35b764c2..edeb75f9 100644 --- a/moulinette/authenticators/ldap.py +++ b/moulinette/authenticators/ldap.py @@ -233,6 +233,7 @@ class Authenticator(BaseAuthenticator): ldif = modlist.modifyModlist(actual_entry[0], attr_dict, ignore_oldexistent=1) if ldif == []: + logger.warning("Nothing to update in LDAP") return True try: