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
diff --git a/tools/install_pip.sh b/tools/install_pip.sh
index 73d0947..b7b40c7 100755
--- a/tools/install_pip.sh
+++ b/tools/install_pip.sh
@@ -42,9 +42,21 @@
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
}