fix invalid properties
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-03-10 14:33:29 +11:00
parent 92e1fdf7c9
commit de92440a58

14
main.go
View File

@@ -166,7 +166,7 @@ func main() {
var hostProperties []mo.HostSystem
err = dcView.Retrieve(ctx, []string{"HostSystem"}, []string{"name", "hardware.systemInfo", "configManager"}, &hostProperties)
if err != nil {
fmt.Printf("Failed to retrieve host properties: %v", err)
log.Printf("Failed to retrieve host properties in datacenter %s: %v", dc.Name, err)
continue
}
@@ -175,20 +175,20 @@ func main() {
clusterName := ""
var hs mo.HostSystem
err = host.Properties(ctx, host.Reference(), []string{"name", "Parent"}, &hs)
err = host.Properties(ctx, host.Reference(), []string{"name", "parent"}, &hs)
if err != nil {
log.Printf("Failed to retrieve host properties: %v", err)
log.Printf("Failed to retrieve host %s parent properties: %v", hs.Name, err)
continue
}
dts, err := host.ConfigManager().DateTimeSystem(ctx)
if err != nil {
fmt.Printf("error: %s\n", err)
os.Exit(1)
log.Printf("Failed to get datetime system for host %s: %v", hs.Name, err)
continue
}
// Get the current ESXi time which is UTC
hostTime, err := dts.Query(ctx)
//fmt.Printf(" - Host: %s; Time: %v\n", hs.Name, hostTime)
// Convert ESXi UTC time to local time
esxiTimeLocal := hostTime.Local()
@@ -217,6 +217,8 @@ func main() {
}
hostTimeErrors = append(hostTimeErrors, thisResult)
} else {
log.Printf("[%s] Host: %s; Time: %v\n", dc.Name, hs.Name, hostTime)
}
/*