Browse Source

Code Improved #2

pull/4153/head
M.A.Sarbanha 2 years ago
committed by GitHub
parent
commit
038ccb1476
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      dnsapi/dns_arvancdn.sh

9
dnsapi/dns_arvancdn.sh

@ -25,8 +25,8 @@ dns_arvancdn_add() {
_saveaccountconf_mutable ARVAN_API_KEY "${ARVAN_API_KEY}" _saveaccountconf_mutable ARVAN_API_KEY "${ARVAN_API_KEY}"
_debug "dns_arvan_add(): Check domain root zone availability for ${_fulldomain}" _debug "dns_arvan_add(): Check domain root zone availability for ${_fulldomain}"
_zone=$(_get_root "${_fulldomain}")
if [ $? -ne 0 ]; then
if ! _zone=$(_get_root "${_fulldomain}"); then
_err "dns_arvan_add(): Root zone for ${_fulldomain} not found!" _err "dns_arvan_add(): Root zone for ${_fulldomain} not found!"
return 1 return 1
fi fi
@ -59,8 +59,7 @@ dns_arvancdn_rm(){
return 1 return 1
fi fi
_zone=$(_get_root "${_fulldomain}")
if [ $? -ne 0 ]; then
if ! _zone=$(_get_root "${_fulldomain}"); then
_err "dns_arvan_rm(): Root zone for ${_fulldomain} not found!" _err "dns_arvan_rm(): Root zone for ${_fulldomain} not found!"
return 1 return 1
fi fi
@ -91,7 +90,7 @@ _get_root(){
_response=$(_get "${ARVAN_CDN_API}/domains") _response=$(_get "${ARVAN_CDN_API}/domains")
#_domains_list=( $( echo "${_response}" | grep -Poe '"domain":"[^"]*"' | sed 's/"domain":"//' | sed 's/"//') ) #_domains_list=( $( echo "${_response}" | grep -Poe '"domain":"[^"]*"' | sed 's/"domain":"//' | sed 's/"//') )
read -a _domains_list < <( echo "${_response}" | grep -Poe '"domain":"[^"]*"' | sed 's/"domain":"//' | sed 's/"//')
read -r -a _domains_list < <( echo "${_response}" | grep -Poe '"domain":"[^"]*"' | sed 's/"domain":"//' | sed 's/"//')
_debug2 "_get_root(): reponse ${_response}" _debug2 "_get_root(): reponse ${_response}"
_debug2 "_get_root(): domains list ${_domains_list[*]}" _debug2 "_get_root(): domains list ${_domains_list[*]}"

Loading…
Cancel
Save