From 8a3f18fb30c9381ec776c5b91edf657b788ce56e Mon Sep 17 00:00:00 2001 From: Vahid Fardi Date: Tue, 5 Jan 2021 00:52:33 +0330 Subject: [PATCH] fix rm function to return 0 --- dnsapi/dns_arvan.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dnsapi/dns_arvan.sh b/dnsapi/dns_arvan.sh index 0b7c6b7e..8af5d0af 100644 --- a/dnsapi/dns_arvan.sh +++ b/dnsapi/dns_arvan.sh @@ -66,7 +66,7 @@ dns_arvan_rm() { _debug "First detect the root zone" if ! _get_root "$fulldomain"; then _err "invalid domain" - return 1 + return 0 fi _debug _domain_id "$_domain_id" _debug _sub_domain "$_sub_domain" @@ -77,17 +77,17 @@ dns_arvan_rm() { if ! printf "%s" "$response" | grep \"current_page\":1 >/dev/null; then _err "Error on Arvan Api" _err "Please create a github issue with debbug log" - return 1 + return 0 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 \") - if ! _arvan_rest "DELETE" "${_domain}/dns-records/${_record_id}"; then - _contains "$response" 'dns record deleted' - return 0 - fi - _debug "$response" + _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 _contains "$response" 'dns record deleted' return 0 + fi + _debug "$response" + _contains "$response" 'dns record deleted' + return 0 } #################### Private functions below ##################################