Commit e8329e73 authored by Edita Kizinevic's avatar Edita Kizinevic
Browse files

Use IPv6 addresses instead of hostname

parent 88c399bc
......@@ -2,7 +2,7 @@
shopt -s expand_aliases
SCRIPT_REVISION="2020-07-17"
SCRIPT_REVISION="2020-11-26"
MAINTAINERS="Dave Dykstra and Edita Kizinevic"
SCRIPT_NAME=`basename "$0"`
......@@ -132,9 +132,25 @@ echo
cd $CMSREL/src
cmsenv
# Use IPv6 if frontier client version is 2.9 or greater
frontier_client=`echo $FRONTIER_CLIENT | sed 's/.*frontier_client\///'`
frontier_major_version=${frontier_client%%.*}
frontier_minor_version=${frontier_client#*.}
frontier_minor_version=${frontier_minor_version%%.*}
use_IPv6=false
re='^[0-9]+$'
if [[ $frontier_major_version =~ $re ]] && [[ $frontier_minor_version =~ $re ]]; then
if [ "$frontier_major_version" -gt "2" ]; then
use_IPv6=true
elif [ "$frontier_major_version" -eq "2" ] && [ "$frontier_minor_version" -ge "9" ]; then
use_IPv6=true
fi
fi
# Function to check proxies
# $1 - list of proxies
# $2 - $pilot
# $3 - $use_IPv6
check_proxies() {
# Script does not use backupproxyurl if it is SAM test, but script uses backupproxyurl if it is pilot
if $2; then
......@@ -151,12 +167,24 @@ check_proxies() {
found_proxy=true
hostname=${proxy#*//}
hostname=${hostname%:*}
# The frontier client does not work with IPv6 addresses in URLs for now
IP_addresses=`getent ahostsv4 $hostname | awk '/STREAM/{print $1}'`
if [ -z "$IP_addresses" ]; then
IPv4_addresses=`getent ahostsv4 $hostname | awk '/STREAM/{print $1}'`
IPv6_addresses=`getent ahostsv6 $hostname | awk '/STREAM/{print $1}' | grep -v ^::ffff:`
if $3; then
if [ -z "$IPv4_addresses" ] && [ -z "$IPv6_addresses" ]; then
IP_addresses=$hostname
elif getent ahostsv6 $hostname | awk '/STREAM/{print $1}' | grep -qv ^::ffff:; then
IP_addresses="$IP_addresses $hostname"
else
IP_addresses=$IPv4_addresses
for IPv6_address in $IPv6_addresses; do
IP_addresses="$IP_addresses [$IPv6_address]"
done
fi
else
IP_addresses=$IPv4_addresses
if [ -z "$IP_addresses" ]; then
IP_addresses=$hostname
elif [ ! -z "$IPv6_addresses" ]; then
IP_addresses="$IP_addresses $hostname"
fi
fi
for IP_address in $IP_addresses; do
if ($2 && ! $ever_succeeded) || ! $2; then
......@@ -195,7 +223,7 @@ check_proxies() {
PROXYLIST="`sed -n '/returned "PROXY/{s/.*returned "//;s/PROXY /(proxyurl=/g;s/;/)/g;s/"/)/;p;q}' $debug_output`"
PROXYLIST=`echo $PROXYLIST | sed "s/(proxyurl=http:\/\/cmsbpfrontier.cern.ch/(backupproxyurl=http:\/\/cmsbpfrontier.cern.ch/g"`
PROXYLIST=`echo $PROXYLIST | sed "s/(proxyurl=http:\/\/cmsbproxy.fnal.gov/(backupproxyurl=http:\/\/cmsbproxy.fnal.gov/g"`
check_proxies "$PROXYLIST" $2
check_proxies "$PROXYLIST" $2 $3
fi
echo "Converting $proxy_config_url proxyconfigurl to proxyurl/backupproxyurl ended:" `date`
echo
......@@ -218,7 +246,7 @@ ever_failed=false
ever_succeeded=false
found_proxyconfig=false
found_proxy=false
check_proxies "$FNCONNECT" $pilot
check_proxies "$FNCONNECT" $pilot $use_IPv6
#Check test results
if [ "$failover" == true ]; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment