mirror of
https://github.com/kubevirt/kubevirt.core.git
synced 2026-03-26 19:03:16 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user