Better check for pypi mirror host connectivity

Now that we have switched to region specific mirrors, we
should look at the pip.conf for the host url/ip and try
the ping/http check on that specific mirror

Change-Id: I28e5988bc7b957f575323778589a974cb51dc7fd
This commit is contained in:
Davanum Srinivas
2014-10-06 09:15:35 -04:00
parent f323125895
commit 6843d0cbd2

View File

@@ -69,9 +69,15 @@ function _http_check {
# do a few network tests to baseline how bad we are
function network_sanity_check {
echo "Performing network sanity check..."
# pypi.openstack.org
_ping_check pypi.openstack.org
_http_check http://pypi.openstack.org/simple/
PIP_CONFIG_FILE=$HOME/.pip/pip.conf
if [[ -f $PIP_CONFIG_FILE ]]; then
line=$(cat $PIP_CONFIG_FILE|grep index-url)
pypi_url=${line#*=}
pypi_host=$(echo $pypi_url|grep -Po '.*?//\K.*?(?=/)')
_ping_check $pypi_host
_http_check $pypi_url
fi
# rax ubuntu mirror
_ping_check mirror.rackspace.com