Skip to content

fix: devkit commands silently return nothing in codename-based deployments (delete-everything broken) #111

@t0kubetsu

Description

@t0kubetsu

Problem

range42-context delete-everything (and any devkit command run inside command substitution $(...)) fails silently in codename-based range42 deployments.

Symptom:

✗ proxmox_vm.list.to.jsons.sh returned no VM data (no vm_id lines) — aborting nuke

Two independent bugs combine to cause this.


Bug 1 — Wrong Ansible host pattern

File: proxmox__inc.jsons.basic_vm_actions.to.jsons.sh

proxmox_node (the PVE cluster node name, e.g. pve) is used as the Ansible - hosts: pattern. In range42, the inventory host key is the infrastructure codename (e.g. hv-lab-01), not the PVE node name.

Ansible warns:

[WARNING]: Could not match supplied host pattern, ignoring: pve

…and produces no output because no host matches.

Root cause: proxmox_node serves two distinct purposes that the devkit conflates:

  • PVE cluster node name (pve) → used by the proxmox_controller role for API calls
  • Ansible inventory host key (hv-lab-01) → used for - hosts: pattern

Bug 2 — Non-TTY empty stdin in command substitution

File: devkit_proxmox.STDIN.stdin_or_jsons.to.jsons.sh

The script uses [ -t 0 ] to decide between using VAULT_NODE (TTY) or reading from stdin (pipe). Inside $() command substitution, stdin is not a TTY even when nothing is piped, so cat - reads empty and produces no output — the entire JSON pipeline returns nothing silently.


Fix

  1. proxmox__inc.jsons.basic_vm_actions.to.jsons.sh: introduce ANSIBLE_HOST="${RANGE42_INFRASTRUCTURE_CODENAME:-$PROXMOX_NODE}" and use it for - hosts: while keeping PROXMOX_NODE for the proxmox_node API variable.

  2. devkit_proxmox.STDIN.stdin_or_jsons.to.jsons.sh: when cat - returns empty (non-TTY, no stdin provided), fall back to $VAULT_NODE instead of producing no output.


Reproduction

  1. Codename-based range42 deployment (inventory host = hv-lab-01, vault proxmox_node = pve)
  2. range42-context use hv-lab-01 <scenario>
  3. range42-context delete-everything → aborts with "no VM data"

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions