Module: check_mk
Branch: master
Commit: 473d11c4eb3fcd04dc522110ddd3e1ccbe475126
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=473d11c4eb3fcd…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Mar 20 17:15:12 2014 +0100
INV: fix some minor exceptions
---
agents/plugins/mk_inventory.linux | 4 ++--
inventory/export_software_csv | 7 ++++---
web/plugins/views/inventory.py | 4 ++--
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/agents/plugins/mk_inventory.linux b/agents/plugins/mk_inventory.linux
index da4b650..0ae6af6 100755
--- a/agents/plugins/mk_inventory.linux
+++ b/agents/plugins/mk_inventory.linux
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Run and *send* only once every 4 hours
INTERVAL=14400
@@ -6,7 +6,7 @@ INTERVAL=14400
FLAGFILE=$MK_CONFDIR/mk_inventory.last.$REMOTE
LAST_RUN=$(stat -c %Y $FLAGFILE)
NOW=$(date +%s)
-UNTIL=$((NOW + INTERVAL))
+UNTIL=$((NOW + INTERVAL + 600))
if [ $(( NOW - LAST_RUN )) -ge $INTERVAL ]
then
diff --git a/inventory/export_software_csv b/inventory/export_software_csv
index 381551c..7ea9b56 100644
--- a/inventory/export_software_csv
+++ b/inventory/export_software_csv
@@ -36,10 +36,11 @@ def inv_export_software_csv(hostname, params, tree):
else:
quote = lambda s: s
- if "software" not in tree or "packages" not in
tree["software"]:
- raise MKGeneralException("Missing Software/Packages in inventory
tree")
+ try:
+ packages = tree["software"]["packages"]
+ except KeyError:
+ return # No software information available
- packages = tree["software"]["packages"]
filename = params["filename"].replace("<HOST>", hostname)
if not filename.startswith("/"):
filename = var_dir + "/" + filename
diff --git a/web/plugins/views/inventory.py b/web/plugins/views/inventory.py
index d94c989..290ef2c 100644
--- a/web/plugins/views/inventory.py
+++ b/web/plugins/views/inventory.py
@@ -29,7 +29,7 @@ import inventory
def paint_host_inventory(row, invpath):
invdata = inventory.get(row["host_inventory"], invpath)
if not invdata:
- return "", _("No inventory data available")
+ return "", "" # _("No inventory data available")
hint = inv_display_hint(invpath)
if "paint_function" in hint:
@@ -772,7 +772,7 @@ class FilterSWPacsVersion(Filter):
new_rows = []
for row in rows:
- version = row[self.name]
+ version = row.get(self.name, "")
if from_version and cmp_version(version, from_version) == -1:
continue
if to_version and cmp_version(version, to_version) == 1: