bind_remove_domain_on_slave.sh: fix error if zone declaration is the last one in zone declaration file.

This commit is contained in:
Christoph 2018-08-12 23:47:47 +02:00
parent aef805100f
commit 27bff721f7

View File

@ -472,6 +472,7 @@ while IFS='' read -r _line || [[ -n $_line ]] ; do
if [[ "$_line" =~ type[[:space:]]+slave ]]; then
_is_slave=true
fi
if $_is_slave && [[ "$_line" =~ ^[[:space:]]*zone[[:space:]]+\"? ]]; then
_found=false
_last_line=$((line_number - 1))
@ -483,6 +484,14 @@ while IFS='' read -r _line || [[ -n $_line ]] ; do
done < "$ZONES_DECLARATION_FILE"
# - if zone declaration was the last one in file "$ZONES_DECLARATION_FILE"
# -
if $_found && [[ $_last_line -eq 0 ]]; then
_last_line=$line_number
_found=false
fi
if $_found ; then
fatal "Configuration for zone '${DOMAIN_REQUESTED_TO_REMOVE}' was found, but cannot be deleted."
fi