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