Module: check_mk
Branch: master
Commit: 0602863aee43e20fc004f9f69e7d2100ef35fdd4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0602863aee43e2…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Nov 19 10:20:34 2015 +0100
#2772 FIX Fixed possible exception in icon column when showing some actions in the column
When e.g. moving the reschedule action icon from the dropdown menu to the column top
level, this could result in an exception when the webserver is not being restarted
after this config change. This has now been fixed to work as expected.
---
.werks/2772 | 11 +++++++++++
ChangeLog | 1 +
web/htdocs/views.py | 19 ++++++++++++-------
web/plugins/views/painters.py | 20 ++++++++++----------
4 files changed, 34 insertions(+), 17 deletions(-)
diff --git a/.werks/2772 b/.werks/2772
new file mode 100644
index 0000000..a7a0deb
--- /dev/null
+++ b/.werks/2772
@@ -0,0 +1,11 @@
+Title: Fixed possible exception in icon column when showing some actions in the column
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.2.7i4
+Date: 1447924751
+Class: fix
+
+When e.g. moving the reschedule action icon from the dropdown menu to the column top
+level, this could result in an exception when the webserver is not being restarted
+after this config change. This has now been fixed to work as expected.
diff --git a/ChangeLog b/ChangeLog
index d58adb6..f11f73c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -113,6 +113,7 @@
* 2447 FIX: Fixed sorting of performancedata values with units...
* 2758 FIX: Fixed processing of metrics containing varnames with quotes and/or
spaces
* 2762 FIX: Fixed formating of check_http when using "clickable URL"
option
+ * 2772 FIX: Fixed possible exception in icon column when showing some actions in the
column...
WATO:
* 2442 WATO remove host: improved cleanup of obsolete host files...
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 4533379..98c582f 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -808,23 +808,28 @@ def get_needed_columns(view, painters):
for entry in painters:
painter = entry[0]
linkview_name = entry[1]
- columns += painter["columns"]
+
+ columns += get_painter_columns(painter)
+
if linkview_name:
linkview = views.get(linkview_name)
if linkview:
for filt in [ visuals.get_filter(fn) for fn in
visuals.get_single_info_keys(linkview) ]:
columns += filt.link_columns
- # The site attribute is no column. Filter it out here
- #if 'site' in columns:
- # columns.remove('site')
-
if len(entry) > 2 and entry[2]:
tt = entry[2]
- columns += multisite_painters[tt]["columns"]
+ columns += get_painter_columns(multisite_painters[tt])
return columns
+def get_painter_columns(painter):
+ if type(lambda: None) == type(painter["columns"]):
+ return painter["columns"]()
+ else:
+ return painter["columns"]
+
+
# Display options are flags that control which elements of a
# view should be displayed (buttons, sorting, etc.). They can be
# specified via the URL variable display_options. The function
@@ -2343,7 +2348,7 @@ def group_value(row, group_painters):
else:
group.append(groupvalfunc(row))
else:
- for c in p[0]["columns"]:
+ for c in get_painter_columns(p[0]):
group.append(row[c])
return tuple(group)
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index ce78910..e845043 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -333,21 +333,21 @@ def iconpainter_columns(what, toplevel):
return cols
multisite_painters["service_icons"] = {
- "title": _("Service icons"),
- "short": _("Icons"),
+ "title" : _("Service icons"),
+ "short" : _("Icons"),
"printable" : False, # does not contain printable text
- "columns": iconpainter_columns("service", toplevel=True),
- "groupby" : lambda row: "", # Do not account for in grouping
- "paint": lambda row: paint_icons("service", row)
+ "columns" : lambda: iconpainter_columns("service",
toplevel=True),
+ "groupby" : lambda row: "", # Do not account for in grouping
+ "paint" : lambda row: paint_icons("service", row)
}
multisite_painters["host_icons"] = {
- "title": _("Host icons"),
- "short": _("Icons"),
+ "title" : _("Host icons"),
+ "short" : _("Icons"),
"printable" : False, # does not contain printable text
- "columns": iconpainter_columns("host", toplevel=True),
- "groupby" : lambda row: "", # Do not account for in grouping
- "paint": lambda row: paint_icons("host", row)
+ "columns" : lambda: iconpainter_columns("host",
toplevel=True),
+ "groupby" : lambda row: "", # Do not account for in grouping
+ "paint" : lambda row: paint_icons("host", row)
}
# -----------------------------------------------------------------------