Introduced variable KNOT_ZONE to resolve issue #2881
This commit is contained in:
parent
c33e5bc40f
commit
faa702a4e5
@ -8,9 +8,12 @@ dns_knot_add() {
|
||||
txtvalue=$2
|
||||
_checkKey || return 1
|
||||
[ -n "${KNOT_SERVER}" ] || KNOT_SERVER="localhost"
|
||||
KNOT_ZONE="${KNOT_ZONE:-$(_readaccountconf_mutable KNOT_ZONE)}"
|
||||
|
||||
# save the dns server and key to the account.conf file.
|
||||
_saveaccountconf KNOT_SERVER "${KNOT_SERVER}"
|
||||
_saveaccountconf KNOT_KEY "${KNOT_KEY}"
|
||||
_saveaccountconf KNOT_ZONE "${KNOT_ZONE}"
|
||||
|
||||
if ! _get_root "$fulldomain"; then
|
||||
_err "Domain does not exist."
|
||||
@ -18,7 +21,7 @@ dns_knot_add() {
|
||||
fi
|
||||
|
||||
_info "Adding ${fulldomain}. 60 TXT \"${txtvalue}\""
|
||||
|
||||
if [ -z "${KNOT_ZONE}" ]; then
|
||||
knsupdate -y "${KNOT_KEY}" <<EOF
|
||||
server ${KNOT_SERVER}
|
||||
zone ${_domain}.
|
||||
@ -26,6 +29,15 @@ update add ${fulldomain}. 60 TXT "${txtvalue}"
|
||||
send
|
||||
quit
|
||||
EOF
|
||||
else
|
||||
knsupdate -y "${KNOT_KEY}" <<EOF
|
||||
server ${KNOT_SERVER}
|
||||
zone ${KNOT_ZONE}.
|
||||
update add ${fulldomain}. 60 TXT "${txtvalue}"
|
||||
send
|
||||
quit
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
_err "Error updating domain."
|
||||
@ -49,6 +61,7 @@ dns_knot_rm() {
|
||||
|
||||
_info "Removing ${fulldomain}. TXT"
|
||||
|
||||
if [ -z "${KNOT_ZONE}" ]; then
|
||||
knsupdate -y "${KNOT_KEY}" <<EOF
|
||||
server ${KNOT_SERVER}
|
||||
zone ${_domain}.
|
||||
@ -56,6 +69,15 @@ update del ${fulldomain}. TXT
|
||||
send
|
||||
quit
|
||||
EOF
|
||||
else
|
||||
knsupdate -y "${KNOT_KEY}" <<EOF
|
||||
server ${KNOT_SERVER}
|
||||
zone ${KNOT_ZONE}.
|
||||
update del ${fulldomain}. TXT
|
||||
send
|
||||
quit
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
_err "error updating domain"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user