fix(scenarios): guard delete/reset scripts against invalid JSON from proxmox_vm.list#47
Open
t0kubetsu wants to merge 1 commit into
Open
fix(scenarios): guard delete/reset scripts against invalid JSON from proxmox_vm.list#47t0kubetsu wants to merge 1 commit into
t0kubetsu wants to merge 1 commit into
Conversation
…proxmox_vm.list Capture the output of proxmox_vm.list.to.jsons.sh into a variable, validate it with jq -e before processing, and abort with a clear error message if the output is not valid JSON. Previously, any non-JSON output (e.g. an API error when the token is stale or Proxmox is unreachable) caused jq to emit a parse error and produce no output. The stop and delete commands then received no VM IDs, silently skipping all deletions while still exiting 0. The subsequent deploy would fail with HTTP 500 "config file already exists". Also removes the misleading "non-fatal" comment in blank_scenario_2_subnets.delete_all.sh that incorrectly described this failure mode as harmless. Affects all 20 delete_all/delete_vms_only/reset.setup scripts across all scenarios: blank_scenario_2/4/6_subnets, debug_scenario_a/b, demo_lab, _init_lab. Fixes #46
a0cd04c to
45b4e71
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
proxmox_vm.list.to.jsons.shoutput into a variable before processing in all delete and reset scriptsjq -e .and aborts with a clear error if it is not valid JSONblank_scenario_2_subnets.delete_all.shProblem
All
delete_all.sh,delete_vms_only.sh, andreset.setup.shscripts pipedproxmox_vm.list.to.jsons.shdirectly intojq -cwith no guard:When the API returns an error string (stale token, Proxmox unreachable),
jqemits a parse error and produces no output. The stop and delete commands receive no VM IDs — silently skipping all deletions while still exiting 0.The
blank_scenario_2_subnets.delete_all.sheven had a comment incorrectly calling this non-fatal. The comment described Ansible warning lines leaking into stdout, which are indeed harmless — but a full non-JSON error response from the API is not, and was being silently ignored.Affected files
20 scripts across all 7 scenarios:
blank_scenario_2/4/6_subnets,debug_scenario_a/b,demo_lab,_init_labRelated
Closes #46
Same pattern fixed in
range42-context.shvia range42/range42#110Discovered during validation run for range42/range42#105