diff --git a/.github/scripts/cleanup-runner-resources.sh b/.github/scripts/cleanup-runner-resources.sh index 3f800f6..dbff7de 100755 --- a/.github/scripts/cleanup-runner-resources.sh +++ b/.github/scripts/cleanup-runner-resources.sh @@ -156,6 +156,10 @@ virtualbox_root_real="$(resolve_existing_dir "$virtualbox_root" || true)" declare -a vm_records=() for state_file in "${state_files[@]}"; do + if [[ ! -f "$state_file" ]]; then + printf 'Skipping Vagrant state removed with its stale scenario directory: %s\n' "$state_file" + continue + fi state_file_real="$(readlink -f -- "$state_file")" state_dir="${state_file_real%/.vagrant/machines/*/virtualbox/id}" machine_dir="${state_file_real%/virtualbox/id}" diff --git a/.github/scripts/test-cleanup-runner-resources.sh b/.github/scripts/test-cleanup-runner-resources.sh index d4cbafa..9408662 100755 --- a/.github/scripts/test-cleanup-runner-resources.sh +++ b/.github/scripts/test-cleanup-runner-resources.sh @@ -12,9 +12,12 @@ molecule_root="$test_root/molecule" virtualbox_root="$test_root/VirtualBox VMs" fake_bin="$test_root/bin" mkdir -p -- "$molecule_root/k3s-ansible/single_node/.vagrant/machines/control1/virtualbox" \ + "$molecule_root/k3s-ansible/single_node/.vagrant/machines/control2/virtualbox" \ "$virtualbox_root/control1" "$virtualbox_root/unmarked" "$fake_bin" printf '%s\n' '11111111-1111-1111-1111-111111111111' \ > "$molecule_root/k3s-ansible/single_node/.vagrant/machines/control1/virtualbox/id" +printf '%s\n' '22222222-2222-2222-2222-222222222222' \ + > "$molecule_root/k3s-ansible/single_node/.vagrant/machines/control2/virtualbox/id" touch "$virtualbox_root/control1/control1.vbox" "$virtualbox_root/control1/disk.vdi" \ "$virtualbox_root/unmarked/unmarked.vbox"