Module: check_mk
Branch: master
Commit: 1cc3b5d920aad9d3209a456b41a738b99d716132
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1cc3b5d920aad9…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jul 6 13:25:56 2017 +0200
Improved selection of virtual host tree elements a bit
Change-Id: Ie5c992ca0fc8172c0c9c93361a5683063f8872e0
---
web/plugins/wato/check_mk_configuration.py | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index aa91c4a..39663cd 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -452,6 +452,17 @@ def validate_virtual_host_trees(value, varprefix):
raise MKUserError(varprefix, _("The ID needs to be unique."))
tree_ids.add(tree["id"])
+ # Validate that each element is selected once
+ seen = set()
+ for element in tree["tag_groups"]:
+ if element in seen:
+ raise MKUserError(varprefix,
+ _("Found '%s' a second time in tree '%s'. Each
element can only be "
+ "choosen once.") % (element, tree["id"]))
+
+ seen.add(element)
+
+
register_configvar(group,
"virtual_host_trees",
@@ -467,12 +478,12 @@ register_configvar(group,
title = _("Title of the tree"),
allow_empty = False,
)),
- ("tag_groups", DualListChoice(
+ ("tag_groups", ListOf(
+ DropdownChoice(
+ choices = virtual_host_tree_choices,
+ ),
+ title = _("Tree levels"),
allow_empty = False,
- custom_order = True,
- choices = virtual_host_tree_choices,
- rows = 10,
- size = 80,
)),
],
optional_keys = [],