Module: check_mk
Branch: master
Commit: a9dc506a197fa8707b98161453fedc9fe1612032
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a9dc506a197fa8…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Aug 4 09:53:25 2016 +0200
3756 FIX Bulk import: Fixed exception when host name contained special characters
---
.werks/3756 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 8 ++++----
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/.werks/3756 b/.werks/3756
new file mode 100644
index 0000000..7b89307
--- /dev/null
+++ b/.werks/3756
@@ -0,0 +1,10 @@
+Title: Bulk import: Fixed exception when host name contained special characters
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i1
+Date: 1470297185
+
+
diff --git a/ChangeLog b/ChangeLog
index 7f8b44f..c0db3eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -525,6 +525,7 @@
* 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
* 3755 FIX: Preventing to insert non ASCII characters in host addresses now
+ * 3756 FIX: Bulk import: Fixed exception when host name contained special 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 432ea6f..b4366b0 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -3074,7 +3074,7 @@ class ModeBulkImport(WatoMode):
file_id = "%s-%d" % (config.user_id, int(time.time()))
f = create_user_file(self._file_path(), "w")
- f.write(content)
+ f.write(content.encode("utf-8"))
f.close()
# make selections available to next page
@@ -3185,15 +3185,15 @@ class ModeBulkImport(WatoMode):
for col_num, value in enumerate(row):
attribute = html.var("attribute_%d" % col_num)
if attribute == "host_name":
- if not re.match('^[a-zA-Z0-9-_.]+$', value):
- raise MKUserError(None, _("Invalid host name: %r. Only the characters a-z, A-Z, "
- "0-9, _, . and - are allowed.") % value)
+ Hostname().validate_value(value, "host")
host_name = value
+
elif attribute and attribute != "-":
if attribute in attributes:
raise MKUserError(None, _("The attribute \"%s\" is assigned to multiple columns. "
"You can not populate one attribute from multiple columns. "
"The column to attribute associations need to be unique.") % attribute)
+
# FIXME: Couldn't we decode all attributes?
if attribute == "alias":
attributes[attribute] = value.decode("utf-8")
Module: check_mk
Branch: master
Commit: a4746e22b06fffc8842be93a4f7e93fe6fdfde63
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a4746e22b06fff…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Aug 4 09:40:12 2016 +0200
3755 FIX Preventing to insert non ASCII characters in host addresses now
---
.bugs/2465 | 7 ++-
.werks/3755 | 9 ++++
ChangeLog | 1 +
web/plugins/wato/builtin_attributes.py | 80 +++++++++++++++++---------------
4 files changed, 58 insertions(+), 39 deletions(-)
diff --git a/.bugs/2465 b/.bugs/2465
index 3a2de88..045cd05 100644
--- a/.bugs/2465
+++ b/.bugs/2465
@@ -1,9 +1,9 @@
Title: ipaddress and ipv6address attributes allow non ASCII characters
Component: wato
-State: open
+Class: bug
+State: done
Date: 2016-08-03 17:09:06
Targetversion: 1.2.8
-Class: bug
It's configured with the TextAttribute() object. Shouldn't we make it only accept ASCII characters
just like the TextASCII() valuespec? Or change these attributes to ValueSpecAttribute() and really
@@ -12,3 +12,6 @@ use TextAscii()?
We should not allow non ascii characters in these fields.
But there are umlaut domains. So: what do to?
+
+2016-08-04 09:37:35: changed state open -> done
+Fixed in master
diff --git a/.werks/3755 b/.werks/3755
new file mode 100644
index 0000000..217808c
--- /dev/null
+++ b/.werks/3755
@@ -0,0 +1,9 @@
+Title: Preventing to insert non ASCII characters in host addresses now
+Level: 1
+Component: wato
+Compatible: compat
+Version: 1.4.0i1
+Date: 1470296371
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 375ef30..7f8b44f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -524,6 +524,7 @@
* 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
+ * 3755 FIX: Preventing to insert non ASCII characters in host addresses now
Notifications:
* 3263 Notifications: allow users to restrict by their contact groups...
diff --git a/web/plugins/wato/builtin_attributes.py b/web/plugins/wato/builtin_attributes.py
index 2beba20..fcc1c78 100644
--- a/web/plugins/wato/builtin_attributes.py
+++ b/web/plugins/wato/builtin_attributes.py
@@ -34,43 +34,49 @@ declare_host_attribute(NagiosTextAttribute("alias", "alias", _("Alias"),
show_in_table = True,
show_in_folder = False)
-declare_host_attribute(TextAttribute("ipaddress", _("IPv4 Address"),
- _("In case the name of the host is not resolvable via <tt>/etc/hosts</tt> "
- "or DNS by your monitoring server, you can specify an explicit IP "
- "address or a resolvable DNS name of the host here.<br> <b>Notes</b>:<br> "
- "1. If you leave this attribute empty, hostname resolution will be done when "
- "you activate the configuration. "
- "Check_MKs builtin DNS cache is activated per default in the global "
- "configuration to speed up the activation process. The cache is normally "
- "updated daily with a cron job. You can manually update the cache with the "
- "command <tt>cmk -v --update-dns-cache</tt>.<br>"
- "2. If you enter a DNS name here, the DNS resolution will be carried out "
- "each time the host is checked. Check_MKs DNS cache will NOT be queried. "
- "Use this only for hosts with dynamic IP addresses."
- ),
- allow_empty = False),
- show_in_table = True,
- show_in_folder = False,
- depends_on_tags = ["ip-v4"])
-
-declare_host_attribute(TextAttribute("ipv6address", _("IPv6 Address"),
- _("In case the name of the host is not resolvable via <tt>/etc/hosts</tt> "
- "or DNS by your monitoring server, you can specify an explicit IPv6 "
- "address or a resolvable DNS name of the host here.<br> <b>Notes</b>:<br> "
- "1. If you leave this attribute empty, hostname resolution will be done when "
- "you activate the configuration. "
- "Check_MKs builtin DNS cache is activated per default in the global "
- "configuration to speed up the activation process. The cache is normally "
- "updated daily with a cron job. You can manually update the cache with the "
- "command <tt>cmk -v --update-dns-cache</tt>.<br>"
- "2. If you enter a DNS name here, the DNS resolution will be carried out "
- "each time the host is checked. Check_MKs DNS cache will NOT be queried. "
- "Use this only for hosts with dynamic IP addresses."
- ),
- allow_empty = False),
- show_in_table = True,
- show_in_folder = False,
- depends_on_tags = ["ip-v6"])
+declare_host_attribute(ValueSpecAttribute("ipaddress",
+ TextAscii(
+ title = _("IPv4 Address"),
+ help = _("In case the name of the host is not resolvable via <tt>/etc/hosts</tt> "
+ "or DNS by your monitoring server, you can specify an explicit IP "
+ "address or a resolvable DNS name of the host here.<br> <b>Notes</b>:<br> "
+ "1. If you leave this attribute empty, hostname resolution will be done when "
+ "you activate the configuration. "
+ "Check_MKs builtin DNS cache is activated per default in the global "
+ "configuration to speed up the activation process. The cache is normally "
+ "updated daily with a cron job. You can manually update the cache with the "
+ "command <tt>cmk -v --update-dns-cache</tt>.<br>"
+ "2. If you enter a DNS name here, the DNS resolution will be carried out "
+ "each time the host is checked. Check_MKs DNS cache will NOT be queried. "
+ "Use this only for hosts with dynamic IP addresses."),
+ allow_empty = False,
+ )),
+ show_in_table = True,
+ show_in_folder = False,
+ depends_on_tags = ["ip-v4"]
+)
+
+declare_host_attribute(ValueSpecAttribute("ipv6address",
+ TextAscii(
+ title = _("IPv6 Address"),
+ help = _("In case the name of the host is not resolvable via <tt>/etc/hosts</tt> "
+ "or DNS by your monitoring server, you can specify an explicit IPv6 "
+ "address or a resolvable DNS name of the host here.<br> <b>Notes</b>:<br> "
+ "1. If you leave this attribute empty, hostname resolution will be done when "
+ "you activate the configuration. "
+ "Check_MKs builtin DNS cache is activated per default in the global "
+ "configuration to speed up the activation process. The cache is normally "
+ "updated daily with a cron job. You can manually update the cache with the "
+ "command <tt>cmk -v --update-dns-cache</tt>.<br>"
+ "2. If you enter a DNS name here, the DNS resolution will be carried out "
+ "each time the host is checked. Check_MKs DNS cache will NOT be queried. "
+ "Use this only for hosts with dynamic IP addresses."),
+ allow_empty = False,
+ )),
+ show_in_table = True,
+ show_in_folder = False,
+ depends_on_tags = ["ip-v6"]
+)
_snmpv3_auth_elements = [
DropdownChoice(
Module: check_mk
Branch: master
Commit: 5bd104d9d3846002b253957d26c52e976495017b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5bd104d9d38460…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Aug 3 17:25:17 2016 +0200
Updated label and help text for custom host macros
---
web/htdocs/wato.py | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 47ada5c..432ea6f 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -14691,10 +14691,19 @@ def mode_edit_custom_attr(phase, what):
label = _("Show the setting of the attribute in the list table"))
forms.section(_('Add as custom macro'))
- html.help(_('The attribute can be added to the contact definiton in order '
- 'to use it for notifications.'))
+ if what == "user":
+ html.help(_('The attribute can be added to the contact definiton in order '
+ 'to use it for notifications.'))
+ label = _("Make this variable available in notifications")
+ else:
+ html.help(_("The attribute can be added to the host definition in order to "
+ "use it as monitoring macro in different places, for example "
+ "as macro in check commands or notifications."))
+ label = _("Make this variable available as monitoring macro, "
+ "e.g. in check commands or in notifications.")
+
html.checkbox('add_custom_macro', attr.get('add_custom_macro', False),
- label = _("Make this variable available in notifications"))
+ label=label)
forms.end()
html.show_localization_hint()
Module: check_mk
Branch: master
Commit: b227cdea10de74c26984bfa31d4cb02f1cf98ed4
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b227cdea10de74…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Aug 3 17:16:44 2016 +0200
Updated bug entries #2466
---
.bugs/2466 | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/.bugs/2466 b/.bugs/2466
new file mode 100644
index 0000000..d0505b5
--- /dev/null
+++ b/.bugs/2466
@@ -0,0 +1,13 @@
+Title: Unicode characters in HTTP variables crash the GUI in different places
+Component: multisite
+State: open
+Date: 2016-08-03 17:14:34
+Targetversion: 1.2.8
+Class: bug
+
+When a unicode character is added to URL variables read with html.vars() and this
+is added to the HTML output which may already be unicode, this results into an exception.
+
+For example this URL: http://localhost/stable/check_mk/view.py?asdx=asd&view_name=allhosts%F0%9F%…
+
+We should solve this in a general place, for example html.var().
Module: check_mk
Branch: master
Commit: 85d5fbee4b366fb995afd771634be69465ac4f4c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=85d5fbee4b366f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Aug 3 17:11:16 2016 +0200
Updated bug entries #2465
---
.bugs/2465 | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/.bugs/2465 b/.bugs/2465
new file mode 100644
index 0000000..3a2de88
--- /dev/null
+++ b/.bugs/2465
@@ -0,0 +1,14 @@
+Title: ipaddress and ipv6address attributes allow non ASCII characters
+Component: wato
+State: open
+Date: 2016-08-03 17:09:06
+Targetversion: 1.2.8
+Class: bug
+
+It's configured with the TextAttribute() object. Shouldn't we make it only accept ASCII characters
+just like the TextASCII() valuespec? Or change these attributes to ValueSpecAttribute() and really
+use TextAscii()?
+
+We should not allow non ascii characters in these fields.
+
+But there are umlaut domains. So: what do to?