Module: check_mk
Branch: master
Commit: a656c974e005b33077a500378103ef9ad9161d2d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a656c974e005b3…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Aug 3 17:04:13 2016 +0200
3754 FIX Cluster nodes are now correctly validated for invalid characters
---
.werks/3754 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 12 +++++++++---
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/.werks/3754 b/.werks/3754
new file mode 100644
index 0000000..4684dff
--- /dev/null
+++ b/.werks/3754
@@ -0,0 +1,10 @@
+Title: Cluster nodes are now correctly validated for invalid characters
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i1
+Date: 1470236636
+
+
diff --git a/ChangeLog b/ChangeLog
index f8e56d2..375ef30 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -523,6 +523,7 @@
* 3726 FIX: Web API: Fixed default output format - using JSON as intended...
* 3733 FIX: BI rule editor: Increased size of argument/parameter/id input fields
* 3735 FIX: Fixed wrong host search link in case of deleting site with hosts
assigned
+ * 3754 FIX: Cluster nodes are now correctly validated for invalid characters
Notifications:
* 3263 Notifications: allow users to restrict by their contact groups...
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 5288484..47ada5c 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -1307,9 +1307,8 @@ def mode_edit_host(phase, new, is_cluster):
# Cluster: nodes
if is_cluster:
- vs = ListOfStrings(valuespec = TextAscii(size = 19),
orientation="horizontal")
forms.section(_("Nodes"))
- vs.render_input("nodes", host and host.cluster_nodes() or [])
+ vs_cluster_nodes().render_input("nodes", host and host.cluster_nodes()
or [])
html.help(_('Enter the host names of the cluster nodes. These '
'hosts must be present in WATO. '))
@@ -1325,13 +1324,20 @@ def mode_edit_host(phase, new, is_cluster):
html.end_form()
+def vs_cluster_nodes():
+ return ListOfStrings(
+ valuespec = TextAscii(size = 19),
+ orientation = "horizontal",
+ )
+
# Called by mode_edit_host() for new/clone/edit
def action_edit_host(mode, hostname, is_cluster):
attributes = collect_attributes("host")
if is_cluster:
- cluster_nodes = ListOfStrings().from_html_vars("nodes")
+ cluster_nodes = vs_cluster_nodes().from_html_vars("nodes")
+ vs_cluster_nodes().validate_value(cluster_nodes, "nodes")
if len(cluster_nodes) < 1:
raise MKUserError("nodes_0", _("The cluster must have at least
one node"))
for nr, cluster_node in enumerate(cluster_nodes):