suspend remote dns if connection failed

This commit is contained in:
Serghey Rodin 2013-10-08 00:21:56 +03:00
commit f70ba768a3
9 changed files with 85 additions and 74 deletions

View file

@ -50,8 +50,10 @@ fi
old_ifs="$IFS"
IFS=$'\n'
# Starting cluster loop
for cluster_str in $(cat $VESTA/conf/dns-cluster.conf); do
# Check remote dns nodes
remote_dns_health_check
for cluster_str in $(grep "SUSPENDED='no'" $VESTA/conf/dns-cluster.conf); do
# Get host values
eval $cluster_str
@ -67,24 +69,10 @@ for cluster_str in $(cat $VESTA/conf/dns-cluster.conf); do
*) send_cmd="send_api_cmd" ;;
esac
# Check host connection
$send_cmd v-list-sys-config
if [ $? -ne 0 ]; then
echo "Error: $TYPE connection to $HOST failed"
log_event "$E_CONNECT $EVENT"
exit $E_CONNECT
fi
# Check recipient dns user
if [ -z "$DNS_USER" ]; then
DNS_USER='dns-cluster'
fi
$send_cmd v-list-user $DNS_USER
if [ $? -ne 0 ]; then
echo "Error: dns user $DNS_USER doesn't exist"
log_event "$E_NOTEXIST $EVENT"
exit $E_NOTEXIST
fi
# Check dns exceptions
if [ -z "$DNS_CLUSTER_IGNORE" ]; then
@ -95,6 +83,11 @@ for cluster_str in $(cat $VESTA/conf/dns-cluster.conf); do
str=$(grep "DOMAIN='$domain'" $USER_DATA/dns.conf)
eval $str
$send_cmd v-insert-dns-domain $DNS_USER "$str" $HOSTNAME 'scheduled'
if [ $? -ne 0 ]; then
echo "Error: $TYPE connection to $HOST failed"
log_event "$E_CONNECT $EVENT"
exit $E_CONNECT
fi
done