fixed LDAP error messages

master
parent 9fbda1e252
commit 458dfd68c5

@ -218,7 +218,7 @@ class ldapFunction(cl_utils2.ldapFun):
parser = addLdif(strLdif,self.conLdap)
parser.parse()
except ldap.LDAPError as e:
self.setError(str(e))
self.setError(e.args[0]['desc'])
return False
except:
self.setError("Error in ldif file")
@ -1482,7 +1482,7 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon, prnServ):
try:
self.conLdap.add_s(DN, entry)
except ldap.LDAPError as e:
self.printERROR(_("LDAP Error") + ": " + str(e).strip())
self.printERROR(_("LDAP Error") + ": " + e.args[0]['desc'].strip())
self.printERROR(errorMessage)
return False
return True
@ -1547,7 +1547,7 @@ This command is not allowed."))
try:
self.conLdap.modify_s(DN, modAttrs)
except ldap.LDAPError as e:
self.printERROR(str(e))
self.printERROR(e.args[0]['desc'])
return False
return True
@ -1558,7 +1558,7 @@ This command is not allowed."))
try:
self.conLdap.modrdn_s(DN, newFirstDn)
except ldap.LDAPError as e:
self.printERROR(str(e))
self.printERROR(e.args[0]['desc'])
return False
return True
@ -1569,7 +1569,7 @@ This command is not allowed."))
try:
self.conLdap.delete_s(DN)
except ldap.LDAPError as e:
self.printERROR(str(e))
self.printERROR(e.args[0]['desc'])
return False
return True
@ -1598,7 +1598,7 @@ This command is not allowed."))
ldap.SCOPE_SUBTREE,
ldapFilter,None)
except ldap.LDAPError as e:
self.printERROR("fullElementDN: " + str(e))
self.printERROR("fullElementDN: " + e.args[0]['desc'])
return False
FDOUT = StringIO("")
writer = LDIFWriter(FDOUT)
@ -1677,7 +1677,7 @@ This command is not allowed."))
'(objectclass=*)',
[''])
except ldap.LDAPError as e:
self.printERROR("deleteDN: "+ str(e))
self.printERROR("deleteDN: "+ e.args[0]['desc'])
return False
for dn, f in dnList:
delListDN.append(dn)
@ -1687,7 +1687,7 @@ This command is not allowed."))
try:
self.conLdap.delete_s(dn)
except ldap.LDAPError as e:
self.printERROR("deleteDN: " + str(e))
self.printERROR("deleteDN: " + e.args[0]['desc'])
return False
return True
@ -8702,7 +8702,7 @@ the extension '.env'")%bFile)
services = []
# Найден ли в списке серверов репликации текущий сервер
flagFoundReplServer = False
fullHostName = "%s.%s"%(hostName,domain)
fullHostName = "%s.%s" % (hostName,domain)
if not fullHostName in replSambaServers:
if fullHostName in replUnixServers:
flagFoundReplServer = True
@ -8727,7 +8727,7 @@ the extension '.env'")%bFile)
if flagFoundReplServer:
if not services:
self.printERROR(_("Inside the archive %s no files \
for running replication")%bFile)
for running replication") % bFile)
return False
else:
self.printERROR(\
@ -8853,20 +8853,20 @@ for running replication")%bFile)
if self.execProg(tarCommand + "--files-from=%s -xjf %s"\
%(listReplFile, bFile)) == False:
self.printERROR(_("Can not extract archive") +\
": "+str(bFile))
": " + str(bFile))
return False
else:
# Распаковываем целиком архив
if self.execProg(tarCommand + "-xjf %s" %(bFile)) == False:
self.printERROR(_("Can not extract archive") +\
": "+str(bFile))
": " + str(bFile))
return False
if not self.changeHostname():
return False
else:
# Распаковываем целиком архив
if self.execProg(tarCommand + "-xjf %s" %(bFile)) == False:
self.printERROR(_("Can not extract archive") + ": "+str(bFile))
self.printERROR(_("Can not extract archive") + ": " + str(bFile))
return False
if not self.changeHostname():
return False
@ -12586,7 +12586,7 @@ if %%errorlevel%%==0 NET USE T: \\\\%s\\ftp' %(netbios,netbios,netbios)
self.conLdap.add_s(self.clVars.Get("ld_repl_mail_dn"),
entry)
except ldap.LDAPError as e:
self.printERROR(_("LDAP Error") + ": " + str(e).strip())
self.printERROR(_("LDAP Error") + ": " + e.args[0]['desc'].strip())
self.printERROR(errorMessage)
return False
except:
@ -12601,7 +12601,7 @@ if %%errorlevel%%==0 NET USE T: \\\\%s\\ftp' %(netbios,netbios,netbios)
self.conLdap.add_s(self.clVars.Get("ld_repl_worked_dn"),
entry)
except ldap.LDAPError as e:
self.printERROR(_("LDAP Error") + ": " + str(e).strip())
self.printERROR(_("LDAP Error") + ": " + e.args[0]['desc'].strip())
self.printERROR(errorMessage)
return False
except:

@ -34,7 +34,7 @@ class ldapFun(cl_profile._error):
try:
self.conLdap = self.__ldapConnect(dnUser, password, host)
except ldap.LDAPError as e:
self.setError(str(e))
self.setError(e.args[0]['desc'])
def __ldapConnect(self, dnUser, password, host):
"""Соединение с LDAP сервером"""

Loading…
Cancel
Save