From 9fbe579f43a502f9ea4e96522002723c2f5eee6d Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Mon, 8 Apr 2024 16:07:24 +1000 Subject: [PATCH] bugfix possible host selection --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index b2df6a0..41e0ddb 100644 --- a/main.go +++ b/main.go @@ -457,6 +457,12 @@ func main() { failedHost = checkActualTime[0].Host.Name outageStart = checkActualTime[0].CreatedTime.In(location) restartTime = vmRestartTime + } else if len(checkActualTime) > 1 { + lastIndex := len(checkActualTime) - 1 + log.Printf("Found multiple hosts corresponding to actual VM restart time. Failed host was '%s', using outage start time of '%s'\n", checkActualTime[lastIndex].Host.Name, checkActualTime[lastIndex].CreatedTime.In(location)) + failedHost = checkActualTime[lastIndex].Host.Name + outageStart = checkActualTime[lastIndex].CreatedTime.In(location) + restartTime = vmRestartTime } else { // if using the actual VM restart time doesn't narrow things down then go back to using the last host failure time before the fuzzy VM restart time lastIndex := len(possibleHosts) - 1