fix dns remove function

This commit is contained in:
Vahid Fardi 2021-01-05 01:11:12 +03:30
parent 8a3f18fb30
commit 93423ce6ad

View File

@ -66,7 +66,7 @@ dns_arvan_rm() {
_debug "First detect the root zone" _debug "First detect the root zone"
if ! _get_root "$fulldomain"; then if ! _get_root "$fulldomain"; then
_err "invalid domain" _err "invalid domain"
return 0 return 1
fi fi
_debug _domain_id "$_domain_id" _debug _domain_id "$_domain_id"
_debug _sub_domain "$_sub_domain" _debug _sub_domain "$_sub_domain"
@ -77,13 +77,13 @@ dns_arvan_rm() {
if ! printf "%s" "$response" | grep \"current_page\":1 >/dev/null; then if ! printf "%s" "$response" | grep \"current_page\":1 >/dev/null; then
_err "Error on Arvan Api" _err "Error on Arvan Api"
_err "Please create a github issue with debbug log" _err "Please create a github issue with debbug log"
return 0 return 1
fi fi
_record_id=$(echo "$response" | _egrep_o ".\"id\":\"[^\"]*\",\"type\":\"txt\",\"name\":\"_acme-challenge\",\"value\":{\"text\":\"$txtvalue\"}" | cut -d : -f 2 | cut -d , -f 1 |tr -d \") _record_id=$(echo "$response" | _egrep_o ".\"id\":\"[^\"]*\",\"type\":\"txt\",\"name\":\"_acme-challenge\",\"value\":{\"text\":\"$txtvalue\"}" | cut -d : -f 2 | cut -d , -f 1 |tr -d \")
if ! _arvan_rest "DELETE" "${_domain}/dns-records/${_record_id}"; then if ! _arvan_rest "DELETE" "${_domain}/dns-records/${_record_id}"; then
_contains "$response" 'dns record deleted' _err "Error on Arvan Api"
return 0 return 1
fi fi
_debug "$response" _debug "$response"
_contains "$response" 'dns record deleted' _contains "$response" 'dns record deleted'