Ommit group when OS id is empty

This commit is contained in:
Xabi Ezpeleta 2021-05-10 13:48:07 +02:00
parent 2b4f351717
commit d7b01396b5
1 changed files with 6 additions and 5 deletions

View File

@ -370,11 +370,12 @@ def main_list(options, config_path):
if 'proxmox_os_id' in results['_meta']['hostvars'][vm]: if 'proxmox_os_id' in results['_meta']['hostvars'][vm]:
osid = results['_meta']['hostvars'][vm]['proxmox_os_id'] osid = results['_meta']['hostvars'][vm]['proxmox_os_id']
if osid not in results: if osid:
results[osid] = { if osid not in results:
'hosts': [] results[osid] = {
} 'hosts': []
results[osid]['hosts'] += [vm] }
results[osid]['hosts'] += [vm]
results['_meta']['hostvars'][vm].update(metadata) results['_meta']['hostvars'][vm].update(metadata)