inventory: Ignore errors connecting to libvirt

If one of the VM hosts is offline, we still want to be able to generate
the inventory from the other host.
unifi-restore
Dustin 2025-07-27 12:35:30 -05:00
parent 53c0107651
commit fad63d5973
1 changed files with 8 additions and 4 deletions

View File

@ -101,10 +101,14 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
assert self.inventory
for uri in uri_list:
try:
if read_only:
conn = libvirt.openReadOnly(uri)
else:
conn = libvirt.open(uri)
except libvirt.libvirtError as e:
log.error('Unable to open to libvirt URI: %s', e)
continue
for dom in conn.listAllDomains():
host = Host(dom)
state = host.get_state()[0]