fix: cluster vm list

Fix the output to show the current number of VMs.

Signed-off-by: Serge Logvinov <serge.logvinov@sinextra.dev>
This commit is contained in:
Serge Logvinov
2025-05-06 14:22:23 +07:00
committed by Serge
parent 5a645a25c3
commit efb753c9de

View File

@@ -83,11 +83,16 @@ func (c *Cluster) CheckClusters(ctx context.Context) error {
return fmt.Errorf("failed to initialized proxmox client in region %s, error: %v", region, err)
}
vms, err := client.GetVmList(ctx)
vmlist, err := client.GetVmList(ctx)
if err != nil {
return fmt.Errorf("failed to get list of VMs in region %s, error: %v", region, err)
}
vms, ok := vmlist["data"].([]interface{})
if !ok {
return fmt.Errorf("failed to cast response to list of VMs in region %s, error: %v", region, err)
}
if len(vms) > 0 {
klog.V(4).InfoS("Proxmox cluster has VMs", "region", region, "count", len(vms))
} else {