From 942b49d61e8dde665c5ef60c4f29cc8d9a63a096 Mon Sep 17 00:00:00 2001 From: Adrian Todorov Date: Sun, 10 Dec 2017 17:22:33 +0100 Subject: [PATCH] fix crash on VM cloning --- vsphere-influxdb.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vsphere-influxdb.go b/vsphere-influxdb.go index 9cfabeb..c538747 100644 --- a/vsphere-influxdb.go +++ b/vsphere-influxdb.go @@ -449,7 +449,9 @@ func (vcenter *VCenter) Query(config Configuration, InfluxDBClient influxclient. if vmToPool[vm.Self] != "" { vmSummary[vm.Self]["respool"] = vmToPool[vm.Self] } - vmSummary[vm.Self]["esx"] = hostSummary[*vm.Summary.Runtime.Host]["name"] + if vm.Summary.Runtime.Host != nil { + vmSummary[vm.Self]["esx"] = hostSummary[*vm.Summary.Runtime.Host]["name"] + } } // get object names