fix(kubevirt): fix inventory labels loop

Fix the for loop ranging over vmi labels. This loop is missing the
.items() statement, which it causes the following error:

```
for key, value in vmi.metadata.labels:
ValueError: too many values to unpack (expected 2)
```

Signed-off-by: Javier Cano Cano <jcanocan@redhat.com>
This commit is contained in:
Javier Cano Cano
2024-05-14 17:26:39 +02:00
parent 48b2a81679
commit a1b0971b7f

View File

@@ -539,7 +539,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
if vmi.metadata.labels and opts.create_groups:
# Create a group for each label_value
vmi_groups = []
for key, value in vmi.metadata.labels:
for key, value in vmi.metadata.labels.items():
group_name = self._sanitize_group_name(f"label_{key}_{value}")
if group_name not in vmi_groups:
vmi_groups.append(group_name)