Skip to content

Commit

Permalink
Merge pull request #359 from odyssey4me/RE-2030-rocky
Browse files Browse the repository at this point in the history
Copy the actual inventory, rather than use the script [rocky]
  • Loading branch information
John Duarte committed Oct 1, 2018
2 parents 7469396 + d864dde commit 19a16ef
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions execute_tests.sh
Expand Up @@ -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 ----------------------------------------------------------------------

Expand All @@ -33,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} \
Expand All @@ -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 --------------------+"

Expand Down

0 comments on commit 19a16ef

Please sign in to comment.