Skip to content

Commit

Permalink
[PR #5672/fab73a1d backport][stable-6] Bugfix: Remove redundant VMID …
Browse files Browse the repository at this point in the history
…parameters (#5709)

Bugfix: Remove redundant VMID parameters (#5672)

* Remove redundant parameters VMID

* Add changelog fragment

(cherry picked from commit fab73a1)

Co-authored-by: castorsky <csky57@gmail.com>
  • Loading branch information
patchback[bot] and castorsky authored Dec 19, 2022
1 parent 82f4b51 commit 02e6a86
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/5672-proxmox.yml
Original file line number Diff line number Diff line change
@@ -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)."
4 changes: 2 additions & 2 deletions plugins/modules/proxmox_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down Expand Up @@ -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)))
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/proxmox_nic.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def delete_nic(self, vmid, interface):

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
Expand Down

0 comments on commit 02e6a86

Please sign in to comment.