fix(ci): Install python3 package first

The run-local-test script is intended to be executed on a CentOS 8
machine. In case of a minimal installation, only the internal Python
interpreter is installed (/usr/libexec/platform-python). This patch
makes sure that the Python 3 package is installed first.

JIRA: #VALFRWK-701

Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
Change-Id: I333464bea2917de17b5b87ba9e5f109cb400cf15
(cherry picked from commit 772d98cf24)
(cherry picked from commit 958160d30d)
(cherry picked from commit e202b48675)
(cherry picked from commit 2c73420ce5)
This commit is contained in:
Gael Chamoulaud (Strider) 2021-12-20 09:46:35 +01:00
parent c6d8b572fa
commit 267f27c6ef
No known key found for this signature in database
GPG Key ID: 4119D0305C651D66
2 changed files with 5 additions and 2 deletions

View File

@ -681,6 +681,7 @@ To use this script execute the following command.
.. code-block:: console
$ cd tripleo-validations
$ ./scripts/run-local-test ${NEWROLENAME}
When using the `run-local-test` script, the TRIPLEO_JOB_ANSIBLE_ARGS

View File

@ -31,12 +31,11 @@ export TRIPLEO_JOB_ANSIBLE_ARGS=${TRIPLEO_JOB_ANSIBLE_ARGS:-""}
# Source distribution information
source /etc/os-release || source /usr/lib/os-release
RHT_PKG_MGR=$(command -v dnf || command -v yum)
PYTHON_EXEC=$(command -v python3 || command -v python)
# Install the one requirement we need to run any local test
case "${ID,,}" in
amzn|rhel|centos|fedora)
sudo "${RHT_PKG_MGR}" install -y python*-virtualenv
sudo "${RHT_PKG_MGR}" install -y python3 python*-virtualenv
;;
esac
@ -44,6 +43,9 @@ esac
sudo mkdir -p /etc/ci
sudo touch /etc/ci/mirror_info.sh
# Get Python Executable
PYTHON_EXEC=$(command -v python3 || command -v python)
# Create a virtual env
"${PYTHON_EXEC}" -m virtualenv --system-site-packages "${HOME}/test-python"