diff --git a/changelogs/fragments/5672-proxmox.yml b/changelogs/fragments/5672-proxmox.yml new file mode 100644 index 0000000000..4fafe53d14 --- /dev/null +++ b/changelogs/fragments/5672-proxmox.yml @@ -0,0 +1,3 @@ +bugfixes: + - "proxmox_disk - fixed possible issues with redundant ``vmid`` parameter (https://github.com/ansible-collections/community.general/issues/5492, https://github.com/ansible-collections/community.general/pull/5672)." + - "proxmox_nic - fixed possible issues with redundant ``vmid`` parameter (https://github.com/ansible-collections/community.general/issues/5492, https://github.com/ansible-collections/community.general/pull/5672)." diff --git a/plugins/modules/cloud/misc/proxmox_disk.py b/plugins/modules/cloud/misc/proxmox_disk.py index 8f55e2d130..8a81f18a3f 100644 --- a/plugins/modules/cloud/misc/proxmox_disk.py +++ b/plugins/modules/cloud/misc/proxmox_disk.py @@ -699,7 +699,7 @@ def main(): module.exit_json(changed=False, vmid=vmid, msg='Disk %s already detached in VM %s' % (disk, vmid)) if disk not in vm_config: module.exit_json(changed=False, vmid=vmid, msg="Disk %s not present in VM %s config" % (disk, vmid)) - proxmox.proxmox_api.nodes(vm['node']).qemu(vmid).unlink.put(vmid=vmid, idlist=disk, force=0) + proxmox.proxmox_api.nodes(vm['node']).qemu(vmid).unlink.put(idlist=disk, force=0) module.exit_json(changed=True, vmid=vmid, msg="Disk %s detached from VM %s" % (disk, vmid)) except Exception as e: module.fail_json(msg="Failed to detach disk %s from VM %s with exception: %s" % (disk, vmid, str(e))) @@ -734,7 +734,7 @@ def main(): try: if disk not in vm_config: module.exit_json(changed=False, vmid=vmid, msg="Disk %s is already absent in VM %s" % (disk, vmid)) - proxmox.proxmox_api.nodes(vm['node']).qemu(vmid).unlink.put(vmid=vmid, idlist=disk, force=1) + proxmox.proxmox_api.nodes(vm['node']).qemu(vmid).unlink.put(idlist=disk, force=1) module.exit_json(changed=True, vmid=vmid, msg="Disk %s removed from VM %s" % (disk, vmid)) except Exception as e: module.fail_json(vmid=vmid, msg='Unable to remove disk %s from VM %s: %s' % (disk, vmid, str(e))) diff --git a/plugins/modules/cloud/misc/proxmox_nic.py b/plugins/modules/cloud/misc/proxmox_nic.py index bcc56de57e..5c8c3f47df 100644 --- a/plugins/modules/cloud/misc/proxmox_nic.py +++ b/plugins/modules/cloud/misc/proxmox_nic.py @@ -223,7 +223,7 @@ class ProxmoxNicAnsible(ProxmoxAnsible): if interface in vminfo: if not self.module.check_mode: - self.proxmox_api.nodes(vm['node']).qemu(vmid).config.set(vmid=vmid, delete=interface) + self.proxmox_api.nodes(vm['node']).qemu(vmid).config.set(delete=interface) return True return False