Merge pull request #73 from 0xFelix/avoid-empty-groups

fix: Return early to avoid adding empty groups.
This commit is contained in:
kubevirt-bot
2024-04-05 10:00:40 +02:00
committed by GitHub

View File

@@ -461,6 +461,10 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
f"Error fetching VirtualMachineInstance list: {self.format_dynamic_api_exc(exc)}"
) from exc
if not vmi_list.items:
# Return early if no VMIs were found to avoid adding empty groups.
return
services = self.get_ssh_services_for_namespace(client, namespace)
name = self._sanitize_group_name(name)