From d7b01396b5d0485721846c18646284320db4a272 Mon Sep 17 00:00:00 2001 From: Xabi Ezpeleta Date: Mon, 10 May 2021 13:48:07 +0200 Subject: [PATCH] Ommit group when OS id is empty --- proxmox.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/proxmox.py b/proxmox.py index 90193d2..46f893e 100755 --- a/proxmox.py +++ b/proxmox.py @@ -370,11 +370,12 @@ def main_list(options, config_path): if 'proxmox_os_id' in results['_meta']['hostvars'][vm]: osid = results['_meta']['hostvars'][vm]['proxmox_os_id'] - if osid not in results: - results[osid] = { - 'hosts': [] - } - results[osid]['hosts'] += [vm] + if osid: + if osid not in results: + results[osid] = { + 'hosts': [] + } + results[osid]['hosts'] += [vm] results['_meta']['hostvars'][vm].update(metadata)