From 958160d30d03c11b8e9155b443d1864d37feb40b Mon Sep 17 00:00:00 2001 From: "Gael Chamoulaud (Strider)" Date: Mon, 20 Dec 2021 09:46:35 +0100 Subject: [PATCH] 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) Change-Id: I333464bea2917de17b5b87ba9e5f109cb400cf15 (cherry picked from commit 772d98cf2405fddb849f030e84d8d176b73a4428) --- doc/source/contributing/developer_guide.rst | 1 + scripts/run-local-test | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/source/contributing/developer_guide.rst b/doc/source/contributing/developer_guide.rst index 56db27162..25b5010c1 100644 --- a/doc/source/contributing/developer_guide.rst +++ b/doc/source/contributing/developer_guide.rst @@ -748,6 +748,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 diff --git a/scripts/run-local-test b/scripts/run-local-test index 168c9f52b..799f9b08a 100755 --- a/scripts/run-local-test +++ b/scripts/run-local-test @@ -40,12 +40,11 @@ set -xeuo # 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 @@ -53,6 +52,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"