Module: check_mk
Branch: master
Commit: fad21dea920e98b2444bafa9ccad35795dd161e6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fad21dea920e98…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Mar 21 17:24:35 2016 +0100
3340 FIX Fixed exception when searching for software package sizes
---
.werks/3340 | 10 ++++++++++
ChangeLog | 1 +
web/plugins/views/inventory.py | 16 +++++++++++-----
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/.werks/3340 b/.werks/3340
new file mode 100644
index 0000000..1917e8b
--- /dev/null
+++ b/.werks/3340
@@ -0,0 +1,10 @@
+Title: Fixed exception when searching for software package sizes
+Level: 1
+Component: inv
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1458577459
+
+
diff --git a/ChangeLog b/ChangeLog
index cb2e3b8..fd4ab94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -204,6 +204,7 @@
* 3265 FIX: mk_inventory.solaris: fix problem on Solaris 10, do prtdiag and prtpicl
only in global zone
* 3289 FIX: Fixed missing filters in HW-/SW-Inventory views after editing the
view...
* 3013 FIX: Inventory: snmp inventory plugins never use cached data...
+ * 3340 FIX: Fixed exception when searching for software package sizes
1.2.8b1:
diff --git a/web/plugins/views/inventory.py b/web/plugins/views/inventory.py
index 3d8a2c6..2daa3b7 100644
--- a/web/plugins/views/inventory.py
+++ b/web/plugins/views/inventory.py
@@ -85,7 +85,7 @@ def declare_inv_column(invpath, datatype, title, short = None):
"cmp" : lambda a, b: cmp_inventory_node(a, b, invpath),
}
- # Declare filter.
+ # Declare filter. Sync this with declare_invtable_columns()
if datatype == "str":
visuals.declare_filter(800, visuals.FilterInvText(name, invpath, title))
else:
@@ -840,15 +840,23 @@ def declare_invtable_columns(infoname, invpath, topic):
render_function_name = "inv_paint_" + paint_name
render_function = globals()[render_function_name]
else:
- paint_name = "text"
+ paint_name = "str"
render_function = None
+ # Sync this with declare_inv_column()
filter_class = hint.get("filter")
+ if not filter_class:
+ if paint_name == "str":
+ filter_class = visuals.FilterInvtableText
+ else:
+ filter_class = visuals.FilterInvtableIDRange
+
declare_invtable_column(infoname, name, topic, hint["title"],
hint.get("short", hint["title"]),
sortfunc, render_function, filter_class)
-def declare_invtable_column(infoname, name, topic, title, short_title, sortfunc,
render_func, filter_class):
+def declare_invtable_column(infoname, name, topic, title, short_title,
+ sortfunc, render_func, filter_class):
column = infoname + "_" + name
if render_func == None:
paint = lambda row: ("", "%s" % row.get(column))
@@ -872,8 +880,6 @@ def declare_invtable_column(infoname, name, topic, title, short_title,
sortfunc,
"cmp" : lambda a, b: sortfunc(a.get(column), b.get(column))
}
- if filter_class == None:
- filter_class = visuals.FilterInvtableText
visuals.declare_filter(800, filter_class(infoname, name, topic + ": " +
title))