Skip to content

Commit

Permalink
Merge pull request #497 from rebtoor/fix-molecule-venv
Browse files Browse the repository at this point in the history
Improved the robustness of `molecule_venv.sh` script
  • Loading branch information
openshift-merge-bot[bot] authored Nov 16, 2023
2 parents 9210df8 + 672d0c6 commit e327d3a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scripts/molecule_venv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@ LOCAL_MOLECULE_ENV=$(mktemp -d)/molecule
if which python3.9 2>/dev/null; then
python3.9 -m venv $LOCAL_MOLECULE_ENV
else
echo WARNING: python3.9 binary is not in path. Tests will run with system python: $(python --version) at $(which python)
python -m venv $LOCAL_MOLECULE_ENV
echo WARNING: python3.9 binary is not in path. Tests will run with system python: $(python3 --version) at $(which python3)
python3 -m venv $LOCAL_MOLECULE_ENV
fi

# some python modules need to be compiled
if ! command -v python3-config 2>/dev/null; then
if -e /etc/redhat-release; then
sudo dnf -y install python3-devel
else
echo "Please, install python3 development package otherwise installation of modules could fail"
fi
fi

source $LOCAL_MOLECULE_ENV/bin/activate

pip install -r molecule-requirements.txt
ansible-galaxy collection install -r requirements.yml
./scripts/test_roles.py
Expand Down

0 comments on commit e327d3a

Please sign in to comment.