mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-07 19:23:09 +00:00
Fix ovirt4.py inventory file for oVirt 4.3 (#54338)
ovirt4.py inventory file fails with oVirt 4.3 with the following error:
Traceback (most recent call last):
File "inventory/ovirt", line 259, in <module>
main()
File "inventory/ovirt", line 250, in main
vm_name=args.host,
File "inventory/ovirt", line 209, in get_data
vms[name] = get_dict_of_struct(connection, vm)
File "inventory/ovirt", line 178, in get_dict_of_struct
(stat.name, stat.values[0].datum) for stat in stats
File "inventory/ovirt", line 178, in <genexpr>
(stat.name, stat.values[0].datum) for stat in stats
IndexError: list index out of range
This commit is contained in:
@@ -176,7 +176,7 @@ def get_dict_of_struct(connection, vm):
|
||||
if vm.name in [vm.name for vm in connection.follow_link(group.vms)]
|
||||
],
|
||||
'statistics': dict(
|
||||
(stat.name, stat.values[0].datum) for stat in stats
|
||||
(stat.name, stat.values[0].datum) for stat in stats if stat.values
|
||||
),
|
||||
'devices': dict(
|
||||
(device.name, [ip.address for ip in device.ips]) for device in devices if device.ips
|
||||
|
||||
Reference in New Issue
Block a user