Module: check_mk
Branch: master
Commit: 18d983174bdaab332df029017c66b0901f817d78
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=18d983174bdaab…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jan 13 07:53:12 2017 +0100
Fixed error in EC views when event is from unknown host
Change-Id: I06c499dea034f55b0b00c932cc8b73fbd9ba0b18
---
web/htdocs/inventory.py | 5 +++++
web/plugins/views/inventory.py | 3 +++
2 files changed, 8 insertions(+)
diff --git a/web/htdocs/inventory.py b/web/htdocs/inventory.py
index 451bdda..47ca3a1 100644
--- a/web/htdocs/inventory.py
+++ b/web/htdocs/inventory.py
@@ -41,6 +41,9 @@ from lib import MKException, MKGeneralException, MKAuthException,
MKUserError, l
# Load data of a host, cache it in the current HTTP request
def host(hostname):
+ if not hostname:
+ return {}
+
invcache = html.get_cached("inventory")
if not invcache:
invcache = {}
@@ -54,6 +57,8 @@ def host(hostname):
return invdata
def has_inventory(hostname):
+ if not hostname:
+ return False
path = cmk.paths.var_dir + "/inventory/" + hostname
return os.path.exists(path)
diff --git a/web/plugins/views/inventory.py b/web/plugins/views/inventory.py
index 04eb056..295fdb6 100644
--- a/web/plugins/views/inventory.py
+++ b/web/plugins/views/inventory.py
@@ -1114,6 +1114,9 @@ def _create_view_enabled_check_func(invpath):
if "host" not in context:
return True # No host data? Keep old behaviour
+ if context["host"] == "":
+ return False
+
tree = inventory.host(context["host"])
if not tree:
return False # Don't show when no inventory data available