|
|
@ -77,7 +77,7 @@ dns_cloudns_rm() {
|
|
|
|
|
|
|
|
|
|
|
|
if [ ! -z "$record_id" ]; then
|
|
|
|
if [ ! -z "$record_id" ]; then
|
|
|
|
_info "Deleting the TXT record for $1"
|
|
|
|
_info "Deleting the TXT record for $1"
|
|
|
|
_dns_cloudns_http_api_call "dns/delete-record.json" "domain-name=$zone&record-id="
|
|
|
|
_dns_cloudns_http_api_call "dns/delete-record.json" "domain-name=$zone&record-id=$record_id"
|
|
|
|
if ! _contains "$response" "\"status\":\"Success\""; then
|
|
|
|
if ! _contains "$response" "\"status\":\"Success\""; then
|
|
|
|
_err "The TXT record for $1 cannot be deleted."
|
|
|
|
_err "The TXT record for $1 cannot be deleted."
|
|
|
|
return 1
|
|
|
|
return 1
|
|
|
@ -103,6 +103,13 @@ _dns_cloudns_init_check() {
|
|
|
|
return 1
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_dns_cloudns_http_api_call "dns/login.json" ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ! _contains "$response" "\"status\":\"Success\""; then
|
|
|
|
|
|
|
|
_err "Invalid CLOUDNS_AUTH_ID or CLOUDNS_AUTH_PASSWORD. Please check your login credentials."
|
|
|
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
CLOUDNS_INIT_CHECK_COMPLETED=1
|
|
|
|
CLOUDNS_INIT_CHECK_COMPLETED=1
|
|
|
|
|
|
|
|
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
@ -134,7 +141,7 @@ _dns_cloudns_get_zone_name() {
|
|
|
|
_dns_cloudns_get_record_id() {
|
|
|
|
_dns_cloudns_get_record_id() {
|
|
|
|
_dns_cloudns_http_api_call "dns/records.json" "domain-name=$1&host=$2&type=TXT"
|
|
|
|
_dns_cloudns_http_api_call "dns/records.json" "domain-name=$1&host=$2&type=TXT"
|
|
|
|
if _contains "$response" "\"id\":"; then
|
|
|
|
if _contains "$response" "\"id\":"; then
|
|
|
|
echo "$response" | awk 'BEGIN { FS="\"" } {print $2}'
|
|
|
|
echo "$response" | cut -d '"' -f 2
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
return 1
|
|
|
|
return 1
|
|
|
@ -146,7 +153,11 @@ _dns_cloudns_http_api_call() {
|
|
|
|
_debug CLOUDNS_AUTH_ID "$CLOUDNS_AUTH_ID"
|
|
|
|
_debug CLOUDNS_AUTH_ID "$CLOUDNS_AUTH_ID"
|
|
|
|
_debug CLOUDNS_AUTH_PASSWORD "$CLOUDNS_AUTH_PASSWORD"
|
|
|
|
_debug CLOUDNS_AUTH_PASSWORD "$CLOUDNS_AUTH_PASSWORD"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ -z $2 ]; then
|
|
|
|
|
|
|
|
data="auth-id=$CLOUDNS_AUTH_ID&auth-password=$CLOUDNS_AUTH_PASSWORD"
|
|
|
|
|
|
|
|
else
|
|
|
|
data="auth-id=$CLOUDNS_AUTH_ID&auth-password=$CLOUDNS_AUTH_PASSWORD&$2"
|
|
|
|
data="auth-id=$CLOUDNS_AUTH_ID&auth-password=$CLOUDNS_AUTH_PASSWORD&$2"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
response="$(_get "$CLOUDNS_API/$method?$data")"
|
|
|
|
response="$(_get "$CLOUDNS_API/$method?$data")"
|
|
|
|
|
|
|
|
|
|
|
|