Fix Ansible bootstrap upper constraint use

When bootstrapping the Ansible runtime venv the version of
pip in the initial venv might be old and unable to understand
the --constraint option.

This patch ensures that the pip, setuptools and wheel upgrade
does not try to use the --constraint option (they're fixed pins
anyway so it's not needed) and then applies the --constraint
option once we know we're at the right version of pip.

Change-Id: Ic482493c800362b896bfe5083b253f1d33d809b5
This commit is contained in:
Jesse Pretorius 2016-10-25 11:43:45 +02:00 committed by Jesse Pretorius (odyssey4me)
parent 6b8c5b671e
commit 8740250ba2

View File

@ -98,8 +98,8 @@ fi
PYTHON_EXEC_PATH="$(which python2 || which python)"
virtualenv --clear ${VIRTUALENV_OPTIONS} --system-site-packages --python="${PYTHON_EXEC_PATH}" /opt/ansible-runtime
# Install ansible
PIP_OPTS+=" --upgrade --constraint ${UPPER_CONSTRAINTS_FILE}"
# The vars used to prepare the Ansible runtime venv
PIP_OPTS+=" --upgrade"
PIP_COMMAND="/opt/ansible-runtime/bin/pip"
# When upgrading there will already be a pip.conf file locking pip down to the
@ -109,6 +109,9 @@ PIP_COMMAND="/opt/ansible-runtime/bin/pip"
# Ensure we are running the required versions of pip, wheel and setuptools
${PIP_COMMAND} install ${PIP_OPTS} ${PIP_INSTALL_OPTIONS} || ${PIP_COMMAND} install ${PIP_OPTS} --isolated ${PIP_INSTALL_OPTIONS}
# Set the constraints now that we know we're using the right version of pip
PIP_OPTS+=" --constraint ${UPPER_CONSTRAINTS_FILE}"
# Install the required packages for ansible
$PIP_COMMAND install $PIP_OPTS -r requirements.txt ${ANSIBLE_PACKAGE} || $PIP_COMMAND install --isolated $PIP_OPTS -r requirements.txt ${ANSIBLE_PACKAGE}