Module: check_mk
Branch: master
Commit: e5c15c48c1e802ce17f46591b93eb784f3646b46
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e5c15c48c1e802…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Dec 14 12:08:44 2018 +0100
Improved werks sorting.
Change-Id: I56776970b729cedaed87bfeaaeef3ef983e8a63e
---
cmk/utils/werks.py | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/cmk/utils/werks.py b/cmk/utils/werks.py
index a5a650c..c3c7a57 100644
--- a/cmk/utils/werks.py
+++ b/cmk/utils/werks.py
@@ -230,15 +230,28 @@ def write_werk_as_text(f, werk):
f.write(" NOTE: Please refer to the migration notes!\n")
+_CLASS_SORTING_VALUE = {
+ "feature": 1,
+ "security": 2,
+ "fix": 3,
+}
+
+_COMPATIBLE_SORTING_VALUE = {
+ "incomp_unack": 1,
+ "incomp_ack": 2,
+ "compat": 3,
+}
+
+
# sort by version and within one version by component
def sort_by_version_and_component(werks):
return sorted(werks,
- key=lambda w: (parse_check_mk_version(w["version"]),
+ key=lambda w: (-parse_check_mk_version(w["version"]),
werk_components().get(w["component"],
w["component"]),
- w["class"] != "fix",
- w["class"] != "sec",
- w["title"]),
- reverse=True)
+ _CLASS_SORTING_VALUE.get(w["class"], 99),
+ -w["level"],
+ _COMPATIBLE_SORTING_VALUE.get(w["compatible"],
99),
+ w["title"]))
def sort_by_date(werks):