From 5be75b8e436e7b2330ef6df7e6fd8a5909a2b6b2 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 20:45:46 +0100 Subject: [PATCH] [PR #7464/03049893 backport][stable-8] fix vm removal in proxmox_pool_member.py (#7494) fix vm removal in proxmox_pool_member.py (#7464) * fix vm removal in proxmox_pool_member.py in the original the vm doesn't get removed, always errors with "'Failed to delete a member (12345) from the pool TestPool: list.remove(x): x not in list' * add changelog fragment * fix linting errors in changelog (cherry picked from commit 03049893922c3b9e9f63f1f67f8a5a0cf6564fab) Co-authored-by: aungvari <12872375+aungvari@users.noreply.github.com> --- .../fragments/7464-fix-vm-removal-in-proxmox_pool_member.yml | 2 ++ plugins/modules/proxmox_pool_member.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/7464-fix-vm-removal-in-proxmox_pool_member.yml diff --git a/changelogs/fragments/7464-fix-vm-removal-in-proxmox_pool_member.yml b/changelogs/fragments/7464-fix-vm-removal-in-proxmox_pool_member.yml new file mode 100644 index 0000000000..b42abc88c0 --- /dev/null +++ b/changelogs/fragments/7464-fix-vm-removal-in-proxmox_pool_member.yml @@ -0,0 +1,2 @@ +bugfixes: + - proxmox_pool_member - absent state for type VM did not delete VMs from the pools (https://github.com/ansible-collections/community.general/pull/7464). diff --git a/plugins/modules/proxmox_pool_member.py b/plugins/modules/proxmox_pool_member.py index 40efb3e1c4..7d6b249493 100644 --- a/plugins/modules/proxmox_pool_member.py +++ b/plugins/modules/proxmox_pool_member.py @@ -192,7 +192,7 @@ class ProxmoxPoolMemberAnsible(ProxmoxAnsible): self.module.exit_json(changed=False, poolid=poolid, member=member, diff=diff, msg="VM {0} is not part of the pool {1}".format(member, poolid)) - all_members_after.remove(member) + all_members_after.remove(vmid) if not self.module.check_mode: self.proxmox_api.pools(poolid).put(vms=[vmid], delete=1)