Add DNS API for ClouDNS

pull/723/head
boyanpeychev 8 years ago
parent c7257e0a3c
commit 0dd6377fe6

@ -20,7 +20,7 @@ dns_cloudns_add () {
return 1
fi
host="$(echo $1 | sed "s/\.$zone\$//")"
host="$(echo "$1" | sed "s/\.$zone\$//")"
record=$2
record_id=$(_dns_cloudns_get_record_id "$zone" "$host")
@ -59,7 +59,7 @@ dns_cloudns_rm () {
return 1
fi
if [ -z $zone ]; then
if [ -z "$zone" ]; then
zone="$(_dns_cloudns_get_zone_name $1)"
if [ -z "$zone" ]; then
_err "Missing DNS zone at ClouDNS. Please log into your control panel and create the required DNS zone for the initial setup."
@ -67,7 +67,7 @@ dns_cloudns_rm () {
fi
fi
host="$(echo $1|sed "s/\.$zone\$//")"
host="$(echo "$1" | sed "s/\.$zone\$//")"
record=$2
record_id=$(_dns_cloudns_get_record_id "$zone" "$host")
@ -90,7 +90,7 @@ dns_cloudns_rm () {
#################### Private functions below ##################################
_dns_cloudns_init_check() {
if [ ! -z $CLOUDNS_INIT_CHECK_COMPLETED ]; then
if [ ! -z "$CLOUDNS_INIT_CHECK_COMPLETED" ]; then
return 0
fi
@ -123,7 +123,7 @@ _dns_cloudns_get_zone_name () {
_dns_cloudns_http_api_call "dns/get-zone-info.json" "domain-name=$zoneForCheck"
if ! _contains "$response" "\"status\":\"Failed\""; then
echo $zoneForCheck
echo "$zoneForCheck"
return 0
fi
@ -135,7 +135,7 @@ _dns_cloudns_get_zone_name () {
_dns_cloudns_get_record_id() {
_dns_cloudns_http_api_call "dns/records.json" "domain-name=$1&host=$2&type=TXT"
if _contains "$response" "\"id\":"; then
echo $response | awk 'BEGIN { FS="\"" } {print $2}'
echo "$response" | awk 'BEGIN { FS="\"" } {print $2}'
return 0
fi
return 1

Loading…
Cancel
Save