Commit 2ece61c2 authored by Edita Kizinevic's avatar Edita Kizinevic
Browse files

Merge branch 'master' into 'master'

Finish running successfully if IPv4 addresses work, but IPv6 addresses do not work

See merge request !30
parents 8c6bc544 5a128484
......@@ -2,7 +2,7 @@
shopt -s expand_aliases
SCRIPT_REVISION="2020-12-01"
SCRIPT_REVISION="2020-12-03"
MAINTAINERS="Dave Dykstra and Edita Kizinevic"
SCRIPT_NAME=`basename "$0"`
......@@ -169,6 +169,10 @@ check_proxies() {
hostname=${hostname%:*}
IPv4_addresses=`getent ahostsv4 $hostname | awk '/STREAM/{print $1}'`
IPv6_addresses=`getent ahostsv6 $hostname | awk '/STREAM/{print $1}' | grep -v ^::ffff:`
IPv4_and_IPv6_addresses_exist=false
if [ ! -z "$IPv4_addresses" ] && [ ! -z "$IPv6_addresses" ]; then
IPv4_and_IPv6_addresses_exist=true
fi
if $3; then
if [ -z "$IPv4_addresses" ] && [ -z "$IPv6_addresses" ]; then
IP_addresses=$hostname
......@@ -203,7 +207,15 @@ check_proxies() {
else
echo "$proxy_IP is FAILED:"
cat $output
ever_failed=true
if $IPv4_and_IPv6_addresses_exist; then
if [[ $IP_address =~ .*:.* ]]; then
IPv6_ever_failed=true
else
ever_failed=true
fi
else
ever_failed=true
fi
fi
echo "Query $proxy ended:" `date`
echo
......@@ -244,38 +256,34 @@ debug_output="debug_output.txt"
output="output.txt"
ever_failed=false
ever_succeeded=false
IPv6_ever_failed=false
found_proxyconfig=false
found_proxy=false
check_proxies "$FNCONNECT" $pilot $use_IPv6_addresses
#Check test results
if [ "$IPv6_ever_failed" == false ]; then
IPv6_message=""
else
IPv6_message=" for IPv4 addresses, although at least one of proxies is FAILED for IPv6 addresses"
fi
if [ "$failover" == true ]; then
message=$'many database queries from the site have connected directly to the Frontier servers or backup proxies, with a high rate of queries not going through the local squid(s):\n'$result
if [ "$ever_failed" == false ] && [ "$ever_succeeded" == true ]; then
echo "Proxy test is OK, however $message"
exit $SAME_WARNING
elif [ "$ever_failed" == true ] && [ "$ever_succeeded" == true ]; then
echo "At least one of proxies is FAILED and $message"
exit $SAME_WARNING
elif [ "$found_proxy" == false ]; then
echo "No proxies are found and $message"
exit $SAME_WARNING
else
echo "Proxy test is FAILED and $message"
exit $SAME_ERROR
fi
failover_message=$' and many database queries from the site have connected directly to the Frontier servers or backup proxies, with a high rate of queries not going through the local squid(s):\n'$result
exit_code=$SAME_WARNING
else
if [ "$ever_failed" == false ] && [ "$ever_succeeded" == true ]; then
echo "Proxy test is OK."
exit $SAME_OK
elif [ "$ever_failed" == true ] && [ "$ever_succeeded" == true ]; then
echo "At least one of proxies is FAILED."
exit $SAME_WARNING
elif [ "$found_proxy" == false ]; then
echo "No proxies are found."
exit $SAME_OK
else
echo "Proxy test is FAILED."
exit $SAME_ERROR
fi
failover_message=""
exit_code=$SAME_OK
fi
if [ "$ever_failed" == false ] && [ "$ever_succeeded" == true ]; then
echo "Proxy test is OK${IPv6_message}${failover_message}"
exit $exit_code
elif [ "$ever_failed" == true ] && [ "$ever_succeeded" == true ]; then
echo "At least one of proxies is FAILED${failover_message}"
exit $SAME_WARNING
elif [ "$found_proxy" == false ]; then
echo "No proxies are found${failover_message}"
exit $exit_code
else
echo "Proxy test is FAILED${failover_message}"
exit $SAME_ERROR
fi
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