Browse Source

Merge pull request #5328 from sahsanu/dev

Fix dns_pdns.sh to use saved account conf
pull/6093/head
neil 2 months ago
committed by GitHub
parent
commit
d058ac6174
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 18
      dnsapi/dns_pdns.sh

18
dnsapi/dns_pdns.sh

@ -20,6 +20,11 @@ dns_pdns_add() {
fulldomain=$1 fulldomain=$1
txtvalue=$2 txtvalue=$2
PDNS_Url="${PDNS_Url:-$(_readaccountconf_mutable PDNS_Url)}"
PDNS_ServerId="${PDNS_ServerId:-$(_readaccountconf_mutable PDNS_ServerId)}"
PDNS_Token="${PDNS_Token:-$(_readaccountconf_mutable PDNS_Token)}"
PDNS_Ttl="${PDNS_Ttl:-$(_readaccountconf_mutable PDNS_Ttl)}"
if [ -z "$PDNS_Url" ]; then if [ -z "$PDNS_Url" ]; then
PDNS_Url="" PDNS_Url=""
_err "You don't specify PowerDNS address." _err "You don't specify PowerDNS address."
@ -46,12 +51,12 @@ dns_pdns_add() {
fi fi
#save the api addr and key to the account conf file. #save the api addr and key to the account conf file.
_saveaccountconf PDNS_Url "$PDNS_Url"
_saveaccountconf PDNS_ServerId "$PDNS_ServerId"
_saveaccountconf PDNS_Token "$PDNS_Token"
_saveaccountconf_mutable PDNS_Url "$PDNS_Url"
_saveaccountconf_mutable PDNS_ServerId "$PDNS_ServerId"
_saveaccountconf_mutable PDNS_Token "$PDNS_Token"
if [ "$PDNS_Ttl" != "$DEFAULT_PDNS_TTL" ]; then if [ "$PDNS_Ttl" != "$DEFAULT_PDNS_TTL" ]; then
_saveaccountconf PDNS_Ttl "$PDNS_Ttl"
_saveaccountconf_mutable PDNS_Ttl "$PDNS_Ttl"
fi fi
_debug "Detect root zone" _debug "Detect root zone"
@ -73,6 +78,11 @@ dns_pdns_rm() {
fulldomain=$1 fulldomain=$1
txtvalue=$2 txtvalue=$2
PDNS_Url="${PDNS_Url:-$(_readaccountconf_mutable PDNS_Url)}"
PDNS_ServerId="${PDNS_ServerId:-$(_readaccountconf_mutable PDNS_ServerId)}"
PDNS_Token="${PDNS_Token:-$(_readaccountconf_mutable PDNS_Token)}"
PDNS_Ttl="${PDNS_Ttl:-$(_readaccountconf_mutable PDNS_Ttl)}"
if [ -z "$PDNS_Ttl" ]; then if [ -z "$PDNS_Ttl" ]; then
PDNS_Ttl="$DEFAULT_PDNS_TTL" PDNS_Ttl="$DEFAULT_PDNS_TTL"
fi fi

Loading…
Cancel
Save