Skip to content

feat(devkit): add Proxmox API fast-path for vm delete (fixes #120)#121

Open
t0kubetsu wants to merge 1 commit into
devfrom
feat/devkit-vm-delete-with-api
Open

feat(devkit): add Proxmox API fast-path for vm delete (fixes #120)#121
t0kubetsu wants to merge 1 commit into
devfrom
feat/devkit-vm-delete-with-api

Conversation

@t0kubetsu

Copy link
Copy Markdown

Summary

  • Adds proxmox_vm.vm_id.delete_with_api.to.jsons.sh: direct DELETE /qemu/{vm_id} via the Proxmox HTTPS API with UPID task polling (60 s timeout), modelled after stop_force_with_api.to.jsons.sh
  • Adds the API delegation guard to proxmox_vm.vm_id.delete.to.jsons.sh — the same RANGE42_PROXMOX_API_FORCE / proxmox__inc.api_reachable.sh block present in all other lifecycle scripts since PR feat: direct Proxmox API fast-path delegation on devkit lifecycle scripts #119

Closes #120.

Why

delete.to.jsons.sh was the only lifecycle script not updated in PR #119. Without the fast-path it always ran the Ansible slow-path, which resolves the inventory host as $PROXMOX_NODE ("pve") when RANGE42_INFRASTRUCTURE_CODENAME is not in scope. The inventory alias is local-lab, so Ansible emitted a warning and silently skipped the delete play, leaving the VM alive.

Test plan

  • range42-context use local-lab gitea_lab && range42-context delete-vms — VM 1183 stops and is deleted
  • Re-running delete-vms when VM is already gone exits cleanly (API returns 404 / empty UPID)
  • RANGE42_PROXMOX_API_FORCE=off range42-context delete-vms falls through to the Ansible slow-path (existing behaviour)
  • proxmox_vm.vm_id.delete_with_api.to.jsons.sh --help prints usage

Adds proxmox_vm.vm_id.delete_with_api.to.jsons.sh (direct DELETE
/qemu/{id} with UPID polling) and wires the same API delegation guard
into proxmox_vm.vm_id.delete.to.jsons.sh so it bypasses the Ansible
slow-path when the API is reachable.

Fixes `range42-context delete-vms` silently skipping deletion due to
the Ansible play targeting the Proxmox node name ("pve") instead of the
inventory alias ("local-lab").

Set RANGE42_PROXMOX_API_FORCE=off to opt out and keep the Ansible path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant