From d94832ec3d1ba8236bbc75ed1283d232fe2c8067 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 9 Apr 2020 19:05:20 +0200 Subject: [PATCH 1/3] Report the actual error when ldap fails --- locales/en.json | 1 - moulinette/authenticators/ldap.py | 35 ++++++++++++++++++++----------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/locales/en.json b/locales/en.json index 36d93a8f..09390047 100644 --- a/locales/en.json +++ b/locales/en.json @@ -19,7 +19,6 @@ "invalid_password": "Invalid password", "invalid_usage": "Invalid usage, pass --help to see help", "ldap_attribute_already_exists": "Attribute '{attribute}' already exists with value '{value}'", - "ldap_operation_error": "An error occurred during LDAP operation", "ldap_server_down": "Unable to reach LDAP server", "logged_in": "Logged in", "logged_out": "Logged out", diff --git a/moulinette/authenticators/ldap.py b/moulinette/authenticators/ldap.py index 15834678..31bafb4a 100644 --- a/moulinette/authenticators/ldap.py +++ b/moulinette/authenticators/ldap.py @@ -141,9 +141,12 @@ class Authenticator(BaseAuthenticator): try: result = self.con.search_s(base, ldap.SCOPE_SUBTREE, filter, attrs) except Exception as e: - logger.exception("error during LDAP search operation with: base='%s', " - "filter='%s', attrs=%s and exception %s", base, filter, attrs, e) - raise MoulinetteError('ldap_operation_error') + raise MoulinetteError( + "error during LDAP search operation with: base='%s', " + "filter='%s', attrs=%s and exception %s" + % (base, filter, attrs, e), + raw_msg=True + ) result_list = [] if not attrs or 'dn' not in attrs: @@ -172,9 +175,12 @@ class Authenticator(BaseAuthenticator): try: self.con.add_s(dn, ldif) except Exception as e: - logger.exception("error during LDAP add operation with: rdn='%s', " - "attr_dict=%s and exception %s", rdn, attr_dict, e) - raise MoulinetteError('ldap_operation_error') + raise MoulinetteError( + "error during LDAP add operation with: rdn='%s', " + "attr_dict=%s and exception %s" + % (rdn, attr_dict, e), + raw_msg=True + ) else: return True @@ -193,8 +199,11 @@ class Authenticator(BaseAuthenticator): try: self.con.delete_s(dn) except Exception as e: - logger.exception("error during LDAP delete operation with: rdn='%s' and exception %s", rdn, e) - raise MoulinetteError('ldap_operation_error') + raise MoulinetteError( + "error during LDAP delete operation with: rdn='%s' and exception %s" + % (rdn, e), + raw_msg=True + ) else: return True @@ -226,10 +235,12 @@ class Authenticator(BaseAuthenticator): self.con.modify_ext_s(dn, ldif) except Exception as e: - logger.exception("error during LDAP update operation with: rdn='%s', " - "attr_dict=%s, new_rdn=%s and exception: %s", rdn, attr_dict, - new_rdn, e) - raise MoulinetteError('ldap_operation_error') + raise MoulinetteError( + "error during LDAP update operation with: rdn='%s', " + "attr_dict=%s, new_rdn=%s and exception: %s" + % (rdn, attr_dict, new_rdn, e), + raw_msg=True + ) else: return True From f5fcefdce69c9703118a7f10a9e854567e37ef80 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 17 Apr 2020 16:59:07 +0200 Subject: [PATCH 2/3] Update changelog for 3.7.1.1 --- debian/changelog | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index ae0263d2..49d40954 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,15 @@ +moulinette (3.7.1.1) stable; urgency=low + + - [fix] Report actual errors when some LDAP operation fails to ease + debugging + + -- Alexandre Aubin Fri, 17 Apr 2020 17:00:00 +0000 + moulinette (3.7.1) stable; urgency=low - [enh] Lazy loading pytz for performances - -- Alexandre Aubin Thu, 9 April 2020 14:55:00 +0000 + -- Alexandre Aubin Thu, 9 Apr 2020 14:55:00 +0000 moulinette (3.7.0.2) stable; urgency=low From 7e8f1af2fa8a631a4c6ee9752ee0ef4e644da2b5 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 20 May 2020 19:00:40 +0000 Subject: [PATCH 3/3] Update changelog for 3.8.1.1 release --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index cc42a4cd..405e29ea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +moulinette (3.8.1.1) stable; urgency=low + + Bumping version number for stable release + + -- Kay0u Wed, 20 May 2020 18:56:36 +0000 + moulinette (3.8.1) testing; urgency=low - [fix] Misc technical ux/debugging fixes (#242, #243, #244, 840f27d2)