1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

add a couple conditionals to make sure updating can be done with vmid… (#5206)

* add a couple conditionals to make sure updating can be done with vmid only

* add changelog to PR

* replace conditional with any

* any takes list

* fix next conditional

* Update changelogs/fragments/5206-proxmox-conditional-vmid.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* capitalize VM and remove conditional for name requirement upon creation

* Fix URL destroyed by GitHub.

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>

Co-authored-by: Yvan E. Watchman <git@yvanwatchman.eu>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
Yvan Watchman 2022-09-12 20:31:30 +02:00 committed by GitHub
parent fbb6ceea1d
commit 19e4b7d3ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -0,0 +1,3 @@
---
bugfixes:
- proxmox_kvm - replace new condition with proper condition to allow for using ``vmid`` on update (https://github.com/ansible-collections/community.general/pull/5206).

View file

@ -1243,8 +1243,10 @@ def main():
module.exit_json(changed=False, vmid=vmid, msg="VM with vmid <%s> already exists" % vmid)
elif proxmox.get_vmid(name, ignore_missing=True) and not (update or clone):
module.exit_json(changed=False, vmid=proxmox.get_vmid(name), msg="VM with name <%s> already exists" % name)
elif (not node) or (not name):
module.fail_json(msg='node, name is mandatory for creating/updating vm')
elif not node:
module.fail.json(msg='node is mandatory for creating/updating VM')
elif update and not any([vmid, name]):
module.fail_json(msg='vmid or name is mandatory for updating VM')
elif not proxmox.get_node(node):
module.fail_json(msg="node '%s' does not exist in cluster" % node)