mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-08-21 10:16:36 +00:00
ddecafee91
Workflow now provisions a throwaway nested PVE VM via Terraform, runs integration tests against it, then destroys it. Uses proxmox-auto-install-assistant to bake the answer file and a first-boot script (installs qemu-guest-agent) directly into the ISO. IP is discovered via the QEMU guest agent on the parent PVE, eliminating the need for static IP configuration. Supports both PVE 8.x and 9.x via workflow_dispatch version selector. Skip provisioning with skip_provision=true to test against a pre-existing PVE. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
26 lines
904 B
Bash
Executable File
26 lines
904 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Remove an uploaded ISO from PVE storage.
|
|
#
|
|
# Usage: cleanup-pve-storage.sh <pve-host> <api-token> <volume-id>
|
|
# e.g.: cleanup-pve-storage.sh 172.16.100.150 "root@pam!tok=secret" "local:iso/proxmox-ve_9.1-1-auto.iso"
|
|
set -euo pipefail
|
|
|
|
PVE_HOST="$1"
|
|
API_TOKEN="$2"
|
|
VOLUME_ID="$3"
|
|
|
|
# Extract node name from API
|
|
NODE=$(curl -sk -H "Authorization: PVEAPIToken=${API_TOKEN}" \
|
|
"https://${PVE_HOST}/api2/json/nodes" \
|
|
| python3 -c "import json,sys; print(json.load(sys.stdin)['data'][0]['node'])")
|
|
|
|
echo "Deleting ${VOLUME_ID} from node ${NODE}..."
|
|
ENCODED_VOLID=$(python3 -c "import urllib.parse; print(urllib.parse.quote('${VOLUME_ID}', safe=''))")
|
|
|
|
RESPONSE=$(curl -sk -X DELETE \
|
|
-H "Authorization: PVEAPIToken=${API_TOKEN}" \
|
|
"https://${PVE_HOST}/api2/json/nodes/${NODE}/storage/local/content/${ENCODED_VOLID}")
|
|
|
|
echo "Response: $RESPONSE"
|
|
echo "Cleanup complete."
|