From 555d28c71e041d399a172270f473b70597c9b5f9 Mon Sep 17 00:00:00 2001 From: Melvin PETIT Date: Wed, 17 Jun 2026 15:29:09 +0200 Subject: [PATCH] fix: use $VAGRANT_CMD in remaining box-remove and sync calls Follow-up to the earlier VAGRANT_CMD fix: 'vagrant box remove' (3 sites in vagrant.sh) and inventory_sync's 'vagrant status'/'vagrant ssh' calls were still hardcoded, so box cleanup and 'bull sync' broke on WSL2 with the VirtualBox provider (VAGRANT_CMD=vagrant.exe). --- lib/inventory.sh | 4 ++-- lib/vagrant.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/inventory.sh b/lib/inventory.sh index caf0236..256cff0 100644 --- a/lib/inventory.sh +++ b/lib/inventory.sh @@ -374,7 +374,7 @@ inventory_sync() { # Get actual status from Vagrant local actual_status - actual_status=$(cd "${vm_dir}" && vagrant status --machine-readable 2>/dev/null \ + actual_status=$(cd "${vm_dir}" && "${VAGRANT_CMD}" status --machine-readable 2>/dev/null \ | grep -E ',state,' | tail -1 | cut -d',' -f4) if [[ -n "${actual_status}" ]]; then @@ -383,7 +383,7 @@ inventory_sync() { # Update IP if running if [[ "${actual_status}" == "running" ]]; then local ip - ip=$(cd "${vm_dir}" && vagrant ssh -c "hostname -I" 2>/dev/null \ + ip=$(cd "${vm_dir}" && "${VAGRANT_CMD}" ssh -c "hostname -I" 2>/dev/null \ | awk '{print $1}' | tr -d '\r') if [[ -n "${ip}" ]]; then inventory_update "${vm_name}" "ip" "${ip}" diff --git a/lib/vagrant.sh b/lib/vagrant.sh index 4eb5caf..a783d76 100644 --- a/lib/vagrant.sh +++ b/lib/vagrant.sh @@ -347,7 +347,7 @@ ensure_vagrant_box() { # Box registered but image missing - clean up and re-register if [[ "${box_registered}" -eq 1 ]] && [[ "${image_exists}" -eq 0 ]]; then log_warn "Box '${box}' registered but image file missing - cleaning up" - vagrant box remove "${box}" --force 2>/dev/null || true + "${VAGRANT_CMD}" box remove "${box}" --force 2>/dev/null || true rm -rf "${vagrant_home}/boxes/${encoded_name}" 2>/dev/null || true fi @@ -750,7 +750,7 @@ _ensure_parrot_qcow2() { # Box registered but qcow2 missing - clean up and re-register if [[ "${box_registered}" -eq 1 ]] && [[ "${qcow2_exists}" -eq 0 ]]; then log_warn "Parrot box registered but qcow2 file missing - cleaning up" - vagrant box remove "${box_name}" --force 2>/dev/null || true + "${VAGRANT_CMD}" box remove "${box_name}" --force 2>/dev/null || true rm -rf "${vagrant_home}/boxes/${encoded_name}" 2>/dev/null || true fi @@ -1028,7 +1028,7 @@ _ensure_parrot_box() { # Box registered but image missing - clean up and re-download if [[ "${box_registered}" -eq 1 ]] && [[ "${image_exists}" -eq 0 ]]; then log_warn "Parrot box registered but image file missing - cleaning up" - vagrant box remove "${box_name}" --force 2>/dev/null || true + "${VAGRANT_CMD}" box remove "${box_name}" --force 2>/dev/null || true rm -rf "${vagrant_home}/boxes/${encoded_name}" 2>/dev/null || true fi