From 8740250ba24a46397a60ca8b94d69259911fb7ba Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Tue, 25 Oct 2016 11:43:45 +0200 Subject: [PATCH] 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 --- scripts/bootstrap-ansible.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/bootstrap-ansible.sh b/scripts/bootstrap-ansible.sh index 97b57810f8..d0b6bfd611 100755 --- a/scripts/bootstrap-ansible.sh +++ b/scripts/bootstrap-ansible.sh @@ -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}