Compare commits

...

4 Commits

Author SHA1 Message Date
Xabi bd1f2b1dbc
Update CHANGELOG.md 2021-09-07 20:59:56 +02:00
Xabi 4f06c2bd9e
Merge pull request #39 from maynero/master
Check if "template" key exists in Proxmox API result
2021-09-07 20:53:49 +02:00
maynero 83005f4ab6 Check if template key exists in api result 2021-07-24 08:41:46 +08:00
Xabi Ezpeleta d7b01396b5 Ommit group when OS id is empty 2021-05-10 13:48:07 +02:00
2 changed files with 13 additions and 6 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## v1.0.2
- Proxmox v7 compatibility check if template key exists (by @maynero) [#39](https://github.com/xezpeleta/Ansible-Proxmox-inventory/pull/39)
## v1.0.1
- Ommit group when OS id is empty (d7b0139)
## v1.0.0
- Added option to ignore invalid SSL certificate (by @bmillemathias) [PR](https://github.com/ansible/ansible/pull/17247)
- Compatible with a Proxmox cluster (by @xezpeleta)

View File

@ -65,7 +65,7 @@ class ProxmoxVMList(list):
def get_names(self):
if self.ver >= 4.0:
return [vm['name'] for vm in self if vm['template'] != 1]
return [vm['name'] for vm in self if 'template' in vm and vm['template'] != 1]
else:
return [vm['name'] for vm in self]
@ -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)