Fix hanlding errors logging

This commit is contained in:
Benjamin Renard 2020-09-23 15:53:58 +02:00 committed by root
parent b9a859c801
commit 66df317940

View file

@ -34,7 +34,7 @@ class LdapServer(object):
if self.raiseOnError:
raise LdapServerException(error)
else:
self.logger.log(level,error)
self.logger.log(level, error)
def connect(self):
if self.con == 0:
@ -85,7 +85,7 @@ class LdapServer(object):
self.con.add_s(dn,ldif)
return True
except ldap.LDAPError, e:
self._error("LdapServer - Error adding %s : %s" % (dn,e), logging.error)
self._error("LdapServer - Error adding %s : %s" % (dn,e), logging.ERROR)
return False
@ -97,7 +97,7 @@ class LdapServer(object):
self.con.modify_s(dn,ldif)
return True
except ldap.LDAPError, e:
self._error("LdapServer - Error updating %s : %s\nOld : %s\nNew : %s" % (dn, e, old, new), logging.error)
self._error("LdapServer - Error updating %s : %s\nOld : %s\nNew : %s" % (dn, e, old, new), logging.ERROR)
return False
def update_need(self, old, new, ignore_attrs=[]):
@ -112,7 +112,7 @@ class LdapServer(object):
self.con.rename_s(dn,new_rdn)
return True
except ldap.LDAPError, e:
self._error("LdapServer - Error renaming %s in %s : %s" % (dn,new_rdn,e), logging.error)
self._error("LdapServer - Error renaming %s in %s : %s" % (dn,new_rdn,e), logging.ERROR)
return False
@ -122,7 +122,7 @@ class LdapServer(object):
self.con.delete_s(dn)
return True
except ldap.LDAPError, e:
self._error("LdapServer - Error deleting %s : %s" % (dn,e), logging.error)
self._error("LdapServer - Error deleting %s : %s" % (dn,e), logging.ERROR)
return False