Module: check_mk
Branch: master
Commit: c84ae7adaa743c5870029b02e6a7d95a225103e3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c84ae7adaa743c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jan 29 15:13:34 2016 +0100
#3038 FIX Fixed invalid error message when creating service group assignment rule without
having service groups
---
.werks/3038 | 9 +++++++++
ChangeLog | 1 +
web/htdocs/valuespec.py | 8 ++++++++
3 files changed, 18 insertions(+)
diff --git a/.werks/3038 b/.werks/3038
new file mode 100644
index 0000000..9dda8dc
--- /dev/null
+++ b/.werks/3038
@@ -0,0 +1,9 @@
+Title: Fixed invalid error message when creating service group assignment rule without
having service groups
+Level: 1
+Component: wato
+Compatible: compat
+Version: 1.2.7i4
+Date: 1454076806
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 87e13fa..fe7500f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -318,6 +318,7 @@
* 2964 FIX: Deleting site having hosts assigned links to list of hosts now
* 2928 FIX: Fix display of rule set Do hardware/software Inventory...
* 3036 FIX: Bulk discovery steps are now timing out short before HTTP request
timeout...
+ * 3038 FIX: Fixed invalid error message when creating service group assignment rule
without having service groups
Notifications:
* 2811 Mail notifications: Now able to add Host/Service Notes Url...
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index f70ee07..187a491 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -3106,6 +3106,14 @@ class ElementSelection(ValueSpec):
ValueSpec.custom_validate(self, value, varprefix)
def validate_datatype(self, value, varprefix):
+ self.load_elements()
+ # When no elements exists the default value is None and e.g. in
wato.mode_edit_rule()
+ # handed over to validate_datatype() before rendering the input form. Disable
the
+ # validation in this case to prevent validation errors. A helpful message is
shown
+ # during render_input()
+ if len(self._elements) == 0 and value == None:
+ return
+
if type(value) != str:
raise MKUserError(varprefix, _("The datatype must be str (string), but
is %s") % type_name(value))