From b35a0bf7fe1d711be9a60c7f529f7465f4b10823 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Mon, 1 Oct 2018 14:24:25 +0100 Subject: [PATCH 1/2] Copy the actual inventory, rather than use the script For all versions of RPC-O, the dynamic inventory script generates a static json file in a fixed path. Rather than trying to run the script (which has different paths depending on the OpenStack series) we can just copy the json file. We implement the logic to check for the presence of a local inventory file before trying to copy it from the MNAIO infra1 source. We also output some debug information to understand which was used when reviewing the console output. JIRA: RE-2030 (cherry picked from commit 1838208c35b5f82a4a2e493394dd927e65496a78) --- execute_tests.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/execute_tests.sh b/execute_tests.sh index 566fcc1..ba6a449 100755 --- a/execute_tests.sh +++ b/execute_tests.sh @@ -13,10 +13,7 @@ export ANSIBLE_HOST_KEY_CHECKING=False SYS_VENV_NAME="${SYS_VENV_NAME:-venv-molecule}" SYS_CONSTRAINTS="constraints.txt" SYS_REQUIREMENTS="requirements.txt" -SYS_INVENTORY="${SYS_INVENTORY:-/opt/openstack-ansible/playbooks/inventory}" -${MNAIO_SSH} test -f "${SYS_INVENTORY}/dynamic_inventory.py" || \ - SYS_INVENTORY="/opt/openstack-ansible/inventory" && ${MNAIO_SSH} test -f "${SYS_INVENTORY}/dynamic_inventory.py" || \ - SYS_INVENTORY="/unknown_inventory_path" +SYS_INVENTORY="${SYS_INVENTORY:-/etc/openstack_deploy/openstack_inventory.json}" ## Main ---------------------------------------------------------------------- @@ -49,7 +46,13 @@ ${VENV_PIP} install ${PIP_OPTIONS} || ${VENV_PIP} install --isolated ${PIP_OPTIO # Generate moleculerized inventory from openstack-ansible dynamic inventory echo "+-------------------- ANSIBLE INVENTORY --------------------+" -${MNAIO_SSH} "${SYS_INVENTORY}/dynamic_inventory.py" > dynamic_inventory.json +if [[ -e ${SYS_INVENTORY} ]]; then + echo "Local inventory source found." + cp ${SYS_INVENTORY} dynamic_inventory.json +else + echo "No local inventory source found, copying from MNAIO infra1 node instead." + rsync infra1:${SYS_INVENTORY} dynamic_inventory.json +fi cat dynamic_inventory.json echo "+-------------------- ANSIBLE INVENTORY --------------------+" From d864dde7bf9a9dbdc0335ed87382de69a172910e Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Mon, 1 Oct 2018 14:47:13 +0100 Subject: [PATCH 2/2] Prevent pip version check from outputting stderr When doing the pip version check, the stderr output if pip does not exist in the virtualenv is a bit confusing, and not useful for the test. Rather than allowing it to leak, we redirect it to /dev/null. (cherry picked from commit 8bb597d4613b3bf99d3679f755c32fc748bcbec0) --- execute_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/execute_tests.sh b/execute_tests.sh index ba6a449..aea6e1b 100755 --- a/execute_tests.sh +++ b/execute_tests.sh @@ -30,7 +30,7 @@ PIP_TARGET="$(awk -F= '/^pip==/ {print $3}' ${SYS_CONSTRAINTS})" VENV_PYTHON="${SYS_VENV_NAME}/bin/python" VENV_PIP="${SYS_VENV_NAME}/bin/pip" -if [[ "$(${VENV_PIP} --version)" != "pip ${PIP_TARGET}"* ]]; then +if [[ "$(${VENV_PIP} --version 2>/dev/null)" != "pip ${PIP_TARGET}"* ]]; then CURL_CMD="curl --silent --show-error --retry 5" OUTPUT_FILE="get-pip.py" ${CURL_CMD} https://bootstrap.pypa.io/get-pip.py > ${OUTPUT_FILE} \