Module: check_mk
Branch: master
Commit: ffad1d6b4bdf543c02e9a36cc34d562920119cdb
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ffad1d6b4bdf54…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Sep 19 14:02:41 2018 +0200
6626 FIX Timeperiod deletion was not possible when using time specific parameters
When trying to delete a timeperiod while a check parameter ruleset uses time specific
parameters, it was not possible to delete this timeperiod. Regardless of which timeperiod
was used in the time specific parameters.
Change-Id: Ib27b55ffee312fee9304844c251a50524da913a1
---
.werks/6626 | 13 +++++++++++++
cmk/gui/wato/pages/timeperiods.py | 8 +++++---
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/.werks/6626 b/.werks/6626
new file mode 100644
index 0000000..46fedcd
--- /dev/null
+++ b/.werks/6626
@@ -0,0 +1,13 @@
+Title: Timeperiod deletion was not possible when using time specific parameters
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1537347738
+
+When trying to delete a timeperiod while a check parameter ruleset uses time specific
+parameters, it was not possible to delete this timeperiod. Regardless of which timeperiod
+was used in the time specific parameters.
diff --git a/cmk/gui/wato/pages/timeperiods.py b/cmk/gui/wato/pages/timeperiods.py
index 6d15238..e469f08 100644
--- a/cmk/gui/wato/pages/timeperiods.py
+++ b/cmk/gui/wato/pages/timeperiods.py
@@ -254,8 +254,10 @@ class ModeTimeperiods(WatoMode):
if not vs.is_active(rule.value):
continue
- # TODO: This method looks wrong: The tpname parameter is unused and this loop is obscure...
- for _rule_tp_name, _value in rule.value["tp_values"]:
+ for index, (rule_tp_name, _value) in enumerate(rule.value["tp_values"]):
+ if rule_tp_name != tpname:
+ continue
+
edit_url = watolib.folder_preserving_link([
("mode", "edit_rule"),
("back_mode", "timeperiods"),
@@ -263,7 +265,7 @@ class ModeTimeperiods(WatoMode):
("rulenr", rule_index),
("rule_folder", rule_folder.path()),
])
- used_in.append((_("Timespecific check parameter"), edit_url))
+ used_in.append((_("Time specific check parameter #%d") % (index + 1), edit_url))
return used_in