It seems that on older ESXi installations, e.g. ESXi 6.7 [0], there are
virtual machines, which do not expose a config property for some VMs.
Therefore, test whether the config is available before checking if the
current entry is a vCLS VM.

[0] https://forum.proxmox.com/threads/164900/

Signed-off-by: Daniel Kral <d.k...@proxmox.com>
---
 listvms.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/listvms.py b/listvms.py
index 89ddfb2..bd0adcf 100755
--- a/listvms.py
+++ b/listvms.py
@@ -266,9 +266,11 @@ def main():
         data = {}
         for vm in list_vms(connection):
             # drop vCLS machines
-            vCLS = any(cfg.key == "HDCS.agent"
-                       and cfg.value.lower() == "true"
-                       for cfg in vm.config.extraConfig)
+            vCLS = vm.config is not None and any(
+                cfg.key == "HDCS.agent"
+                and cfg.value.lower() == "true"
+                for cfg in vm.config.extraConfig
+            )
             if vCLS:
                 continue
             # drop vms with empty datastore

base-commit: e6f497ea7668e6956ec4461837cf613a0736e684
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to