Module: check_mk
Branch: master
Commit: 34dadda3307be581f61aff8fe6e500aa1ac43bf6
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=34dadda3307be5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Nov 14 20:37:58 2016 +0100
3918 FIX Inventory history: Fixed possible exception when renedering history tables
Different kind of exceptions could occur, all in the inv_*() functions. For example
in inv_paint_timestamp_as_age() the error "TypeError: unsupported operand type(s) for -: 'float' and 'tuple'"
---
.werks/3918 | 11 +++++++++++
ChangeLog | 1 +
web/plugins/views/inventory.py | 6 +++++-
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/.werks/3918 b/.werks/3918
new file mode 100644
index 0000000..c6e77f2
--- /dev/null
+++ b/.werks/3918
@@ -0,0 +1,11 @@
+Title: Inventory history: Fixed possible exception when renedering history tables
+Level: 1
+Component: inv
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i3
+Date: 1479152226
+
+Different kind of exceptions could occur, all in the inv_*() functions. For example
+in inv_paint_timestamp_as_age() the error "TypeError: unsupported operand type(s) for -: 'float' and 'tuple'"
diff --git a/ChangeLog b/ChangeLog
index 0dbdeeb..6b4c691 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -42,6 +42,7 @@
* 4066 FIX: Fixed broken titles of nodes in inventory views
* 4067 FIX: Fixed broken inventory history view in current master...
* 3917 FIX: Fixed broken dicttable rendering
+ * 3918 FIX: Inventory history: Fixed possible exception when renedering history tables...
1.4.0i2:
diff --git a/web/plugins/views/inventory.py b/web/plugins/views/inventory.py
index a2e79df..e953bed 100644
--- a/web/plugins/views/inventory.py
+++ b/web/plugins/views/inventory.py
@@ -263,7 +263,8 @@ def render_inv_subtree_leaf_value(hostname, tree_id, invpath, node):
def render_inv_dicttable(hostname, tree_id, invpath, node):
- # In delta mode node is a pair of (old_items, new_items)
+ # In delta mode where nodes have been added/removed, node is a pair of
+ # (old_items, new_items)
if type(node) == tuple:
if node[0]:
html.write_text(_("Removed entries") + ":")
@@ -331,7 +332,10 @@ def render_inv_dicttable(hostname, tree_id, invpath, node):
invpath_sub += ":"
hint = inv_display_hint(invpath_sub)
+
if "paint_function" in hint:
+ # The value is not really needed, but we need to deal with the delta mode
+ value = value[1] if type(value) == tuple else value
td_class, text = hint["paint_function"](value)
else:
td_class = None