Module: check_mk
Branch: master
Commit: a0fdccfbe359bd05c1f4b629fb06e0a997bb0e32
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a0fdccfbe359bd…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed May 9 20:17:59 2012 +0200
WATO: bugfix in sort_sites(..) function
---
web/htdocs/wato.py | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index efdcc1d..a755b71 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -6025,7 +6025,7 @@ def find_usage_of_timeperiod(tpname):
# Sort given sites argument by peer/local, followed by slaves
def sort_sites(sites):
def custom_sort(a,b):
- if a[1].get("replication","") ==
b[1].get("replication"):
+ if a[1].get("replication","peer") ==
b[1].get("replication","peer"):
# Compare by alias
if a[1].get("alias") == b[1].get("alias"):
return 0
@@ -6033,10 +6033,12 @@ def sort_sites(sites):
return 1
else:
return -1
- elif a[1].get("replication","") == "slave" and
b[1].get("replication") != "slave":
+ elif a[1].get("replication") == "slave" and
b[1].get("replication","peer") != "slave":
return 1
- elif a[1].get("replication","") != "slave" and
b[1].get("replication") == "slave":
+ elif a[1].get("replication","peer") != "slave" and
b[1].get("replication") == "slave":
return -1
+ else:
+ return 0
sites.sort(cmp = custom_sort)
def mode_sites(phase):