Ensure PIP requirements are always met

This change is necessary to ensure that all the required PIP packages
are installed. Without this change the code assumes that if the version
of `pip` in okay then all the required packages are already installed.

Change-Id: I16a4eaf24e346411a7f0890d69939f666ecc6be3
This commit is contained in:
git-harry 2017-07-13 09:38:13 +01:00
parent db23a2a2cc
commit 9ff145e3b2

View File

@ -270,15 +270,16 @@ function pre_flight {
chmod +x py_pkgs.py chmod +x py_pkgs.py
popd popd
# Upgrade pip if it's needed. This will re-install pip using the constraints and then # Upgrade pip if it's needed. This will re-install pip using the constraints
# re-install all of the remaining requirements as needed.
if dpkg --compare-versions "$(pip --version | awk '{print $2}')" "lt" "9.0.1"; then if dpkg --compare-versions "$(pip --version | awk '{print $2}')" "lt" "9.0.1"; then
wget https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py -O /opt/get-pip.py wget https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py -O /opt/get-pip.py
rm -rf /usr/local/lib/python2.7/dist-packages/{setuptools,wheel,pip,distutils,packaging}* rm -rf /usr/local/lib/python2.7/dist-packages/{setuptools,wheel,pip,distutils,packaging}*
python /opt/get-pip.py --constraint "${SYSTEM_PATH}/lib/upgrade-requirements.txt" --force-reinstall --upgrade --isolated python /opt/get-pip.py --constraint "${SYSTEM_PATH}/lib/upgrade-requirements.txt" --force-reinstall --upgrade --isolated
pip install --requirement "${SYSTEM_PATH}/lib/upgrade-requirements.txt" --upgrade --isolated
fi fi
# Ensure all of the required packages are installed
pip install --requirement "${SYSTEM_PATH}/lib/upgrade-requirements.txt" --upgrade --isolated
if [[ -d "/opt/ansible-runtime" ]]; then if [[ -d "/opt/ansible-runtime" ]]; then
rm -rf "/opt/ansible-runtime" rm -rf "/opt/ansible-runtime"
fi fi