fix(install/ansible): reload env after venv.sh so PYTHON points into the venv

scripts/install/ansible.sh inherited PYTHON=python3 from all.sh because
the first env-generation runs before the venv exists and the PYTHON
handler falls back to "python3" (literal). On a CI runner that resolves
to actions/setup-python's interpreter, which has no `ansible` distribution
even though pip just installed one into the venv -- `ansible-galaxy
collection install` then fails with ModuleNotFoundError.

Mirror the reload-after-venv pattern that scripts/install/python.sh
already uses: when ${VENV}/bin/python now exists and the inherited
PYTHON still points at the system fallback, drop INFINITO_ENV_LOADED
and re-source load.sh so it prepends ${VENV}/bin to PATH for the
remainder of this subshell.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 4.7 committed 2026-05-20 22:26:16 +02:00
1 parent eb4bcd23a8
commit b79ed28698
1 file changed
+9
+9
View File
@@ -1,6 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
# 🔁 Reload env after venv.sh: first env-gen runs before the venv exists, so PYTHON is the system fallback.
if [[ -n "${VENV:-}" && -x "${VENV}/bin/python" && "${PYTHON:-}" != "${VENV}/bin/python" ]]; then
unset INFINITO_ENV_LOADED
unset PYTHON
unset PIP
# shellcheck source=scripts/meta/env/load.sh
source "${ENV_SH:-scripts/meta/env/load.sh}"
fi
echo "📦 Installing Ansible collections"
: "${PYTHON:?PYTHON not set}"