inventory: ovirt4: Add support for devices without IP (#24287)

This commit is contained in:
Ondra Machacek 2017-05-04 21:22:48 +02:00 committed by Matt Davis
parent 4bd04c299b
commit 2c58ac1833

View file

@ -182,9 +182,9 @@ def get_dict_of_struct(connection, vm):
(stat.name, stat.values[0].datum) for stat in stats
),
'devices': dict(
(device.name, [ip.address for ip in device.ips]) for device in devices
(device.name, [ip.address for ip in device.ips]) for device in devices if device.ips
),
'ansible_host': devices[0].ips[0].address if len(devices) > 0 else None,
'ansible_host': next((device.ips[0].address for device in devices if device.ips), None)
}