Module: check_mk
Branch: master
Commit: ef562a5c56fad1e495d5884692bcc2ff3ee0798a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ef562a5c56fad1…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Sep 20 14:49:50 2018 +0200
Fixed KeyError while getting status data via LQ for the inventory tree
Change-Id: I9b38e1123a71dc304abdb0f99d5414f8a36f5f0d
---
cmk/gui/plugins/views/inventory.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/cmk/gui/plugins/views/inventory.py b/cmk/gui/plugins/views/inventory.py
index 021033a..b00b49f 100644
--- a/cmk/gui/plugins/views/inventory.py
+++ b/cmk/gui/plugins/views/inventory.py
@@ -1314,17 +1314,18 @@ def declare_invtable_view(infoname, invpath, title_singular,
title_plural):
def _create_view_enabled_check_func(invpath, is_history=False):
def _check_view_enabled(linking_view, view, context_vars):
context = dict(context_vars)
- if "host" not in context:
+ hostname = context.get("host")
+ if hostname is None:
return True # No host data? Keep old behaviour
- if context["host"] == "":
+ elif hostname == "":
return False
# FIXME In order to decide whether this view is enabled
# do we really need to load the whole tree?
if is_history:
- struct_tree =
inventory.load_filtered_inventory_tree(context["host"])
+ struct_tree = inventory.load_filtered_inventory_tree(hostname)
else:
- row = inventory.get_status_data_via_livestatus(context["site"],
context["host"])
+ row = inventory.get_status_data_via_livestatus(context.get("site"),
hostname)
struct_tree = inventory.load_filtered_and_merged_tree(row)
if not struct_tree: