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
This commit is contained in:
Ian Wienand 2015-03-10 11:32:26 +11:00
parent d8b66662d5
commit 7c4ce9edba
2 changed files with 15 additions and 3 deletions

2
.gitignore vendored
View File

@ -14,7 +14,7 @@ files/*.gz
files/*.qcow2 files/*.qcow2
files/images files/images
files/pip-* files/pip-*
files/get-pip.py files/get-pip.py*
local.conf local.conf
local.sh local.sh
localrc localrc

View File

@ -42,9 +42,21 @@ function get_versions {
function install_get_pip { function install_get_pip {
if [[ ! -r $LOCAL_PIP ]]; then # the openstack gate and others put a cached version of get-pip.py
curl --retry 6 --retry-delay 5 -o $LOCAL_PIP $PIP_GET_PIP_URL || \ # 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" die $LINENO "Download of get-pip.py failed"
touch $LOCAL_PIP.downloaded
fi fi
sudo -H -E python $LOCAL_PIP sudo -H -E python $LOCAL_PIP
} }