Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
69392f67
Unverified
Commit
69392f67
authored
Jan 22, 2020
by
Radek SPRTA
Browse files
Correctly handle .co.uk type domains
parent
e7d130cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_clouddns.sh
View file @
69392f67
...
...
@@ -118,15 +118,24 @@ dns_clouddns_rm() {
# _domain_id=sdjkglgdfewsdfg
_get_root
()
{
domain
=
$1
domain_root
=
$(
echo
"
$fulldomain
"
| _egrep_o
'\.([^\.]*\.[^\.]*)$'
|
cut
-c
2-
)
_debug domain_root
"
$domain_root
"
# Get domain root
data
=
"{
\"
search
\"
: [{
\"
name
\"
:
\"
clientId
\"
,
\"
operator
\"
:
\"
eq
\"
,
\"
value
\"
:
\"
$CLOUDDNS_CLIENT_ID
\"
}]}"
response
=
"
$(
_clouddns_api
"POST"
"domain/search"
"
$data
"
|
tr
-d
'\t\r\n '
)
"
_debug2
"response"
"
$response
"
domain_slice
=
"
$domain
"
while
[
-z
"
$domain_root
"
]
;
do
if
_contains
"
$response
"
"
\"
domainName
\"
:
\"
$domain_slice
\.\"
"
;
then
domain_root
=
"
$domain_slice
"
_debug domain_root
"
$domain_root
"
fi
domain_slice
=
"
$(
echo
"
$domain_slice
"
|
cut
-d
.
-f
2-
)
"
done
# Get domain id
data
=
"{
\"
search
\"
: [{
\"
name
\"
:
\"
clientId
\"
,
\"
operator
\"
:
\"
eq
\"
,
\"
value
\"
:
\"
$CLOUDDNS_CLIENT_ID
\"
},
\
{
\"
name
\"
:
\"
domainName
\"
,
\"
operator
\"
:
\"
eq
\"
,
\"
value
\"
:
\"
$domain_root
.
\"
}]}"
{
\"
name
\"
:
\"
domainName
\"
,
\"
operator
\"
:
\"
eq
\"
,
\"
value
\"
:
\"
$domain_root
.
\"
}]}"
response
=
"
$(
_clouddns_api
"POST"
"domain/search"
"
$data
"
|
tr
-d
'\t\r\n '
)
"
_debug
"Domain id
$response
"
if
_contains
"
$response
"
"
\"
id
\"
:
\"
"
;
then
re
=
'domainType\":\"[^\"]*\",\"id\":\"([^\"]*)\",'
# Match domain id
_domain_id
=
$(
echo
"
$response
"
| _egrep_o
"
$re
"
| _head_n 1 |
cut
-d
:
-f
3 |
tr
-d
"
\"
,"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment