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

pull/24309/head
Ondra Machacek 8 years ago committed by Matt Davis
parent 4bd04c299b
commit 2c58ac1833

@ -182,9 +182,9 @@ def get_dict_of_struct(connection, vm):
(stat.name, stat.values[0].datum) for stat in stats (stat.name, stat.values[0].datum) for stat in stats
), ),
'devices': dict( '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)
} }

Loading…
Cancel
Save