From 7c4ce9edbad6f3c33469d45be832ebea4a46ff70 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 10 Mar 2015 11:32:26 +1100 Subject: [PATCH] Check for new versions of get-pip.py People can leave their devstack installs around for a long time, and in the mean time new versions of pip can be released. The current check does not download a new version if an old one exists. We want to check for new versions, but we also don't want the gate jobs trying this sometimes unreliable fetch. So add a flag-file that tells devstack if it downloaded get-pip.py originally. If so, on each run check for a new version using curl's "-z" flag to request only files modified since the file's timestamp. Change-Id: I91734528f02deafabf3d18d968c3abd749751199 Closes-Bug: #1429943 --- .gitignore | 2 +- tools/install_pip.sh | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 67ab722190..c6900c881c 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ files/*.gz files/*.qcow2 files/images files/pip-* -files/get-pip.py +files/get-pip.py* local.conf local.sh localrc diff --git a/tools/install_pip.sh b/tools/install_pip.sh index 73d0947320..b7b40c7486 100755 --- a/tools/install_pip.sh +++ b/tools/install_pip.sh @@ -42,9 +42,21 @@ function get_versions { function install_get_pip { - if [[ ! -r $LOCAL_PIP ]]; then - curl --retry 6 --retry-delay 5 -o $LOCAL_PIP $PIP_GET_PIP_URL || \ + # the openstack gate and others put a cached version of get-pip.py + # for this to find, explicitly to avoid download issues. + # + # However, if devstack *did* download the file, we want to check + # for updates; people can leave thier stacks around for a long + # time and in the mean-time pip might get upgraded. + # + # Thus we use curl's "-z" feature to always check the modified + # since and only download if a new version is out -- but only if + # it seems we downloaded the file originally. + if [[ ! -r $LOCAL_PIP || -r $LOCAL_PIP.downloaded ]]; then + curl --retry 6 --retry-delay 5 \ + -z $LOCAL_PIP -o $LOCAL_PIP $PIP_GET_PIP_URL || \ die $LINENO "Download of get-pip.py failed" + touch $LOCAL_PIP.downloaded fi sudo -H -E python $LOCAL_PIP }