Improve ContextCSN error messages

This commit is contained in:
Benjamin Renard 2017-09-12 13:09:35 +02:00
parent 2ece7b0cab
commit 43df1e8de3

View file

@ -398,10 +398,15 @@ if options.nagios:
errors=[] errors=[]
if not options.nocheckcontextcsn: if not options.nocheckcontextcsn:
if not LdapServersCSN[options.provider]:
errors.append('ContextCSN of LDAP server provider could not be found')
else:
for srv in LdapServersCSN: for srv in LdapServersCSN:
if srv==options.provider: if srv==options.provider:
continue continue
if LdapServersCSN[srv]!=LdapServersCSN[options.provider]: if not LdapServersCSN[srv]:
errors.append('ContextCSN of %s not found' % srv)
elif LdapServersCSN[srv]!=LdapServersCSN[options.provider]:
errors.append('ContextCSN of %s not the same of provider' % srv) errors.append('ContextCSN of %s not the same of provider' % srv)
if len(not_found[options.consumer])>0: if len(not_found[options.consumer])>0:
@ -420,9 +425,17 @@ else:
noerror=True noerror=True
for srv in servers: for srv in servers:
if not options.nocheckcontextcsn: if not options.nocheckcontextcsn:
if not LdapServersCSN[options.provider]:
logging.warning('ContextCSN of LDAP server provider could not be found')
noerror=False
else:
for srv in LdapServersCSN:
if srv==options.provider: if srv==options.provider:
continue continue
if LdapServersCSN[srv]!=LdapServersCSN[options.provider]: if not LdapServersCSN[srv]:
logging.warning('ContextCSN of %s not found' % srv)
noerror=False
elif LdapServersCSN[srv]!=LdapServersCSN[options.provider]:
logging.warning('ContextCSN of %s not the same of provider' % srv) logging.warning('ContextCSN of %s not the same of provider' % srv)
noerror=False noerror=False