Use runtime venv to determine OSA version

With the introduction of c44fbcbbe3,
setuptools is used to determine the current OSA version. However,
currently it relies on setuptools being present on the host. This
is an unnecessary dependency given that we have setuptools in the
runtime venv.

Rather than add more dependencies on the host, we now use the
runtime venv to check for the version of OSA.

Change-Id: I5bf11906c87d308567af483263e753ab4f9e2815
This commit is contained in:
Marc Gariepy 2019-02-14 10:32:45 -05:00 committed by Jesse Pretorius (odyssey4me)
parent c99e545814
commit a30ce47845

View File

@ -110,9 +110,6 @@ fi
PYTHON_EXEC_PATH="${PYTHON_EXEC_PATH:-$(which python2 || which python)}"
PYTHON_VERSION="$($PYTHON_EXEC_PATH -c 'import sys; print(".".join(map(str, sys.version_info[:3])))')"
# Get current code version (this runs at the root of OSA clone)
CURRENT_OSA_VERSION=$(cd ${OSA_CLONE_DIR}; ${PYTHON_EXEC_PATH} setup.py --version)
# Use https when Python with native SNI support is available
UPPER_CONSTRAINTS_PROTO=$([ "$PYTHON_VERSION" == $(echo -e "$PYTHON_VERSION\n2.7.9" | sort -V | tail -1) ] && echo "https" || echo "http")
@ -142,6 +139,9 @@ PIP_OPTS+=" --constraint ${UPPER_CONSTRAINTS_FILE}"
# Upgrade pip setuptools and wheel to the appropriate version
${PIP_COMMAND} install --isolated ${PIP_OPTS} --upgrade pip setuptools wheel
# Get current code version (this runs at the root of OSA clone)
CURRENT_OSA_VERSION=$(cd ${OSA_CLONE_DIR}; /opt/ansible-runtime/bin/python setup.py --version)
# Install ansible and the other required packages
${PIP_COMMAND} install --isolated ${PIP_OPTS} -r requirements.txt ${ANSIBLE_PACKAGE}