1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-22 09:24:21 +01:00

don't stop on UserDoesntExist exception on delete

previously, if a user didn't exist in one backend, the _deleteuser
function in ldapcherry would stop on the UserDoesntExist exception,
potentially leaving the user in other backends.
Now it logs it and continues to delete the user in other backend.
This commit is contained in:
kakwa 2016-07-31 10:06:17 +02:00
parent cf97f01245
commit fec09b1543

View File

@ -847,7 +847,14 @@ class LdapCherry(object):
admin = sess.get(SESSION_KEY, None) admin = sess.get(SESSION_KEY, None)
for b in self.backends: for b in self.backends:
try:
self.backends[b].del_user(username) self.backends[b].del_user(username)
except UserDoesntExist as e:
cherrypy.log.error(
msg="User '" + username +
"' didn't exist in backend '" + b + "'",
severity=logging.INFO
)
cherrypy.log.error( cherrypy.log.error(
msg="user '" + username + "' deleted from backend '" + b + "'", msg="user '" + username + "' deleted from backend '" + b + "'",
severity=logging.DEBUG severity=logging.DEBUG