Merge "Ensure ansible bootstrap works properly with py35"

This commit is contained in:
Jenkins 2017-07-07 23:32:45 +00:00 committed by Gerrit Code Review
commit b57f7f3c78
2 changed files with 12 additions and 5 deletions

View File

@ -30,9 +30,6 @@ export DEBIAN_FRONTEND=${DEBIAN_FRONTEND:-"noninteractive"}
# Set the role fetch mode to any option [galaxy, git-clone]
export ANSIBLE_ROLE_FETCH_MODE=${ANSIBLE_ROLE_FETCH_MODE:-git-clone}
# virtualenv vars
VIRTUALENV_OPTIONS="--always-copy"
# This script should be executed from the root directory of the cloned repo
cd "$(dirname "${0}")/.."
@ -73,7 +70,7 @@ case ${DISTRO_ID} in
git python3-all python3-dev curl python3.5-dev build-essential \
libssl-dev libffi-dev netcat python3-requests python3-openssl python3-pyasn1 \
python3-netaddr python3-prettytable python3-crypto python3-yaml \
python3-virtualenv
python3-virtualenv python3-venv
;;
esac
@ -98,6 +95,15 @@ UPPER_CONSTRAINTS_PROTO=$([ "$PYTHON_VERSION" == $(echo -e "$PYTHON_VERSION\n2.7
# Set the location of the constraints to use for all pip installations
export UPPER_CONSTRAINTS_FILE=${UPPER_CONSTRAINTS_FILE:-"$UPPER_CONSTRAINTS_PROTO://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?id=$(awk '/requirements_git_install_branch:/ {print $2}' playbooks/defaults/repo_packages/openstack_services.yml)"}
# Figure out the right virtualenv command and options
if [[ ${PYTHON_VERSION} =~ ^3 ]]; then
VIRTUALENV_COMMAND="python3 -m venv"
VIRTUALENV_OPTIONS=${VIRTUALENV_OPTIONS:-"--copies"}
else
VIRTUALENV_COMMAND="virtualenv --python=${PYTHON_EXEC_PATH}"
VIRTUALENV_OPTIONS=${VIRTUALENV_OPTIONS:-"--always-copy"}
fi
# Create a Virtualenv for the Ansible runtime
if [ -f "/opt/ansible-runtime/bin/python" ]; then
VENV_PYTHON_VERSION="$(/opt/ansible-runtime/bin/python -c 'import sys; print(".".join(map(str, sys.version_info[:3])))')"
@ -105,7 +111,7 @@ if [ -f "/opt/ansible-runtime/bin/python" ]; then
rm -rf /opt/ansible-runtime
fi
fi
virtualenv --clear ${VIRTUALENV_OPTIONS} --python="${PYTHON_EXEC_PATH}" /opt/ansible-runtime
${VIRTUALENV_COMMAND} --clear ${VIRTUALENV_OPTIONS} /opt/ansible-runtime
# The vars used to prepare the Ansible runtime venv
PIP_OPTS+=" --upgrade"

View File

@ -186,6 +186,7 @@ if [[ "${ACTION}" == "upgrade" ]]; then
# requirements to be installed.
unset ANSIBLE_PACKAGE
unset UPPER_CONSTRAINTS_FILE
unset VIRTUALENV_OPTIONS
# Kick off the data plane tester
${OSA_CLONE_DIR}/tests/data-plane-test.sh &