+

Fixed attributes check : added sort of values before comparing

Benjamin Renard [2013-02-26 12:45:36]
Fixed attributes check : added sort of values before comparing
Filename
check_syncrepl_extended
diff --git a/check_syncrepl_extended b/check_syncrepl_extended
index 2a1e90c..9a0cc5c 100755
--- a/check_syncrepl_extended
+++ b/check_syncrepl_extended
@@ -240,10 +240,14 @@ for obj in LdapObjects[options.provider]:
 						if attr not in LdapObjects[srv][obj]:
 							attrs_list.append(attr)
 							logging.debug("Obj %s not synchronized : %s not present on %s" % (obj,','.join(attrs_list),srv))
-						elif LdapObjects[srv][obj][attr]!=LdapObjects[options.provider][obj][attr]:
-							attrs_list.append(attr)
-							logging.debug("Obj %s not synchronized : %s not same value(s)" % (obj,','.join(attrs_list)))
-					not_sync[srv].append("%s (%s)" % (obj,','.join(attrs_list)))
+						else:
+							LdapObjects[srv][obj][attr].sort()
+							LdapObjects[options.provider][obj][attr].sort()
+							if LdapObjects[srv][obj][attr]!=LdapObjects[options.provider][obj][attr]:
+								attrs_list.append(attr)
+								logging.debug("Obj %s not synchronized : %s not same value(s)" % (obj,','.join(attrs_list)))
+					if len(attrs_list)>0:
+						not_sync[srv].append("%s (%s)" % (obj,','.join(attrs_list)))
 				else:
 					logging.debug("Obj %s not synchronized : %s <-> %s" % (obj,LdapObjects[options.provider][obj],LdapObjects[srv][obj]))
 					not_sync[srv].append(obj)
ViewGit