Module: check_mk
Branch: master
Commit: 982df473e64b57aae4ee950faf56d59a0a7cdcff
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=982df473e64b57…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Jul 26 11:29:18 2018 +0200
6386 FIX esx_vsphere_hostsystem: Fixed crash if no hardware system information is
available
Change-Id: Ife0a6d25d465ffce220254136ba5dc80efc7b24e
---
.werks/6386 | 11 +++++++++++
inventory/esx_vsphere_hostsystem | 9 +++++----
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/.werks/6386 b/.werks/6386
new file mode 100644
index 0000000..941568b
--- /dev/null
+++ b/.werks/6386
@@ -0,0 +1,11 @@
+Title: esx_vsphere_hostsystem: Fixed crash if no hardware system information is
available
+Level: 1
+Component: inv
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1532597254
+
+
diff --git a/inventory/esx_vsphere_hostsystem b/inventory/esx_vsphere_hostsystem
index b738617..566bf12 100644
--- a/inventory/esx_vsphere_hostsystem
+++ b/inventory/esx_vsphere_hostsystem
@@ -108,10 +108,11 @@ def inv_esx_vsphere_hostsystem(info):
if node["vendor"] == "HP":
node["serial"] =
data["hardware.systemInfo.otherIdentifyingInfo.ServiceTag"]["0"]
- if "uuid" in data["hardware.systemInfo"]:
- node["uuid"] =
data["hardware.systemInfo"]["uuid"]
- if "0" in data["hardware.systemInfo"]:
- node["serial"] =
data["hardware.systemInfo"]["0"]["ServiceTag"]
+ hardware_systeminfo = data.get("hardware.systemInfo", {})
+ if "uuid" in hardware_systeminfo:
+ node["uuid"] = hardware_systeminfo["uuid"]
+ if "0" in hardware_systeminfo:
+ node["serial"] =
hardware_systeminfo["0"]["ServiceTag"]
if "memorySize" in data["hardware"]:
node = inv_tree("hardware.memory.")
node["total_ram_usable"] =
int(data["hardware"]["memorySize"])