mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add check for empty records and add test
This commit is contained in:
parent
4b4505e3f9
commit
c7e7b6c9e3
2 changed files with 15 additions and 2 deletions
|
@ -200,6 +200,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
||||||
|
|
||||||
server['name'] = vm.NAME
|
server['name'] = vm.NAME
|
||||||
server['id'] = vm.ID
|
server['id'] = vm.ID
|
||||||
|
if vm.HISTORY_RECORDS.HISTORY[-1]:
|
||||||
server['host'] = vm.HISTORY_RECORDS.HISTORY[-1].HOSTNAME
|
server['host'] = vm.HISTORY_RECORDS.HISTORY[-1].HOSTNAME
|
||||||
server['LABELS'] = labels
|
server['LABELS'] = labels
|
||||||
server['v4_first_ip'] = self._get_vm_ipv4(vm)
|
server['v4_first_ip'] = self._get_vm_ipv4(vm)
|
||||||
|
|
|
@ -58,7 +58,19 @@ def get_vm_pool():
|
||||||
'ETIME': 0,
|
'ETIME': 0,
|
||||||
'GID': 132,
|
'GID': 132,
|
||||||
'GNAME': 'CSApparelVDC',
|
'GNAME': 'CSApparelVDC',
|
||||||
'HISTORY_RECORDS': {},
|
'HISTORY_RECORDS': OrderedDict({
|
||||||
|
'HISTORY': OrderedDict({
|
||||||
|
'OID': '42',
|
||||||
|
'SEQ': '384',
|
||||||
|
'HOSTNAME': 'sam-691-sam',
|
||||||
|
'HID': '10',
|
||||||
|
'CID': '0',
|
||||||
|
'DS_ID': '100',
|
||||||
|
'VM_MAD': 'kvm',
|
||||||
|
'TM_MAD': '3par',
|
||||||
|
'ACTION': '0'
|
||||||
|
})
|
||||||
|
}),
|
||||||
'ID': 7157,
|
'ID': 7157,
|
||||||
'LAST_POLL': 1632762935,
|
'LAST_POLL': 1632762935,
|
||||||
'LCM_STATE': 3,
|
'LCM_STATE': 3,
|
||||||
|
|
Loading…
Reference in a new issue