diff --git a/main.go b/main.go index d74d1ab..50c11ac 100644 --- a/main.go +++ b/main.go @@ -120,8 +120,7 @@ func main() { // Login to vcenter c, err = govmomi.NewClient(ctx, u, *vInsecure) if err != nil { - fmt.Fprintf(os.Stderr, "Logging in error: %s\n", err) - os.Exit(1) + log.Fatalf("Logging in error: %s\n", err) } defer c.Logout(ctx) @@ -163,12 +162,15 @@ func main() { } // Retrieve host properties - var hostProperties []mo.HostSystem - err = dcView.Retrieve(ctx, []string{"HostSystem"}, []string{"name", "hardware.systemInfo", "configManager"}, &hostProperties) - if err != nil { - log.Printf("Failed to retrieve host properties in datacenter %s: %v", dc.Name, err) - continue - } + /* + var hostProperties []mo.HostSystem + err = dcView.Retrieve(ctx, []string{"HostSystem"}, []string{"name", "hardware.systemInfo", "configManager"}, &hostProperties) + if err != nil { + log.Printf("Failed to retrieve host properties in datacenter %s: %v", dc.Name, err) + continue + } + */ + log.Printf("DC %s contains %d hosts\n", dc.Name, len(hosts)) // Print hosts for _, host := range hosts {