bugfix possible host selection
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-04-08 16:07:24 +10:00
parent 919ffd52cf
commit 9fbe579f43

View File

@@ -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