From 6843d0cbd23ec125e299b71e580eebd8349d9c66 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Mon, 6 Oct 2014 09:15:35 -0400 Subject: [PATCH] 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 --- functions.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/functions.sh b/functions.sh index 0c74491c..70e766eb 100644 --- a/functions.sh +++ b/functions.sh @@ -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