Removed more extra spaces
This commit is contained in:
parent
e2d74b4616
commit
1002a10af4
@ -35,7 +35,7 @@ dns_digitalocean_add() {
|
|||||||
fi
|
fi
|
||||||
_debug _sub_domain "$_sub_domain"
|
_debug _sub_domain "$_sub_domain"
|
||||||
_debug _domain "$_domain"
|
_debug _domain "$_domain"
|
||||||
|
|
||||||
## Set the header with our post type and key auth key
|
## Set the header with our post type and key auth key
|
||||||
export _H1="Content-Type: application/json"
|
export _H1="Content-Type: application/json"
|
||||||
export _H2="Authorization: Bearer $DO_API_KEY"
|
export _H2="Authorization: Bearer $DO_API_KEY"
|
||||||
@ -48,14 +48,14 @@ dns_digitalocean_add() {
|
|||||||
## the create request - post
|
## the create request - post
|
||||||
## args: BODY, URL, [need64, httpmethod]
|
## args: BODY, URL, [need64, httpmethod]
|
||||||
response="$(_post "$PBODY" "$PURL")"
|
response="$(_post "$PBODY" "$PURL")"
|
||||||
|
|
||||||
## check response (sort of)
|
## check response (sort of)
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
_err "error in response: $response"
|
_err "error in response: $response"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
_debug response "$response"
|
_debug response "$response"
|
||||||
|
|
||||||
## finished correctly
|
## finished correctly
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ dns_digitalocean_rm() {
|
|||||||
fi
|
fi
|
||||||
_debug _sub_domain "$_sub_domain"
|
_debug _sub_domain "$_sub_domain"
|
||||||
_debug _domain "$_domain"
|
_debug _domain "$_domain"
|
||||||
|
|
||||||
## Set the header with our post type and key auth key
|
## Set the header with our post type and key auth key
|
||||||
export _H1="Content-Type: application/json"
|
export _H1="Content-Type: application/json"
|
||||||
export _H2="Authorization: Bearer $DO_API_KEY"
|
export _H2="Authorization: Bearer $DO_API_KEY"
|
||||||
@ -94,11 +94,11 @@ dns_digitalocean_rm() {
|
|||||||
domain_list="$(_get "$GURL")"
|
domain_list="$(_get "$GURL")"
|
||||||
## 2) find record
|
## 2) find record
|
||||||
## check for what we are looing for: "type":"A","name":"$_sub_domain"
|
## check for what we are looing for: "type":"A","name":"$_sub_domain"
|
||||||
record="$(echo "$domain_list" | _egrep_o "\"id\"\s*\:\s*\"*\d+\"*[^}]*\"name\"\s*\:\s*\"$_sub_domain\"[^}]*\"data\"\s*\:\s*\"$txtvalue\"" )"
|
record="$(echo "$domain_list" | _egrep_o "\"id\"\s*\:\s*\"*\d+\"*[^}]*\"name\"\s*\:\s*\"$_sub_domain\"[^}]*\"data\"\s*\:\s*\"$txtvalue\"")"
|
||||||
## 3) check record and get next page
|
## 3) check record and get next page
|
||||||
if [ -z "$record" ]; then
|
if [ -z "$record" ]; then
|
||||||
## find the next page if we dont have a match
|
## find the next page if we dont have a match
|
||||||
nextpage="$(echo "$domain_list" | _egrep_o "\"links\".*" | _egrep_o "\"next\".*" | _egrep_o "http.*page\=\d+" )"
|
nextpage="$(echo "$domain_list" | _egrep_o "\"links\".*" | _egrep_o "\"next\".*" | _egrep_o "http.*page\=\d+")"
|
||||||
if [ -z "$nextpage" ]; then
|
if [ -z "$nextpage" ]; then
|
||||||
_err "no record and no nextpage in digital ocean DNS removal"
|
_err "no record and no nextpage in digital ocean DNS removal"
|
||||||
return 1
|
return 1
|
||||||
@ -110,24 +110,24 @@ dns_digitalocean_rm() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
## we found the record
|
## we found the record
|
||||||
rec_id="$(echo "$record" | _egrep_o "id\"\s*\:\s*\"*\d+" | _egrep_o "\d+" )"
|
rec_id="$(echo "$record" | _egrep_o "id\"\s*\:\s*\"*\d+" | _egrep_o "\d+")"
|
||||||
_debug rec_id "$rec_id"
|
_debug rec_id "$rec_id"
|
||||||
|
|
||||||
## delete the record
|
## delete the record
|
||||||
## delete URL for removing the one we dont want
|
## delete URL for removing the one we dont want
|
||||||
DURL="https://api.digitalocean.com/v2/domains/$_domain/records/$rec_id"
|
DURL="https://api.digitalocean.com/v2/domains/$_domain/records/$rec_id"
|
||||||
|
|
||||||
## the create request - delete
|
## the create request - delete
|
||||||
## args: BODY, URL, [need64, httpmethod]
|
## args: BODY, URL, [need64, httpmethod]
|
||||||
response="$(_post "" "$DURL" "" "DELETE")"
|
response="$(_post "" "$DURL" "" "DELETE")"
|
||||||
|
|
||||||
## check response (sort of)
|
## check response (sort of)
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
_err "error in remove response: $response"
|
_err "error in remove response: $response"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
_debug response "$response"
|
_debug response "$response"
|
||||||
|
|
||||||
## finished correctly
|
## finished correctly
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ _get_base_domain() {
|
|||||||
_debug "split domain" "$domain"
|
_debug "split domain" "$domain"
|
||||||
_debug "split dom_point" "$dom_point"
|
_debug "split dom_point" "$dom_point"
|
||||||
_debug "split sub_point" "$sub_point"
|
_debug "split sub_point" "$sub_point"
|
||||||
|
|
||||||
# domain max length - 253
|
# domain max length - 253
|
||||||
MAX_DOM=255
|
MAX_DOM=255
|
||||||
|
|
||||||
@ -165,10 +165,10 @@ _get_base_domain() {
|
|||||||
_err "invalid split location"
|
_err "invalid split location"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_debug "split _domain" "$_domain"
|
_debug "split _domain" "$_domain"
|
||||||
_debug "split _sub_domain" "$_sub_domain"
|
_debug "split _sub_domain" "$_sub_domain"
|
||||||
|
|
||||||
## all ok
|
## all ok
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user