Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
f063dd19
Commit
f063dd19
authored
Mar 15, 2017
by
boyanpeychev
Browse files
some additional fixes and removed awk
parent
be972fc0
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_cloudns.sh
View file @
f063dd19
...
...
@@ -77,7 +77,7 @@ dns_cloudns_rm() {
if
[
!
-z
"
$record_id
"
]
;
then
_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
_err
"The TXT record for
$1
cannot be deleted."
return
1
...
...
@@ -103,6 +103,13 @@ _dns_cloudns_init_check() {
return
1
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
return
0
...
...
@@ -134,7 +141,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
"
|
cut
-d
'"'
-f
2
return
0
fi
return
1
...
...
@@ -146,7 +153,11 @@ _dns_cloudns_http_api_call() {
_debug CLOUDNS_AUTH_ID
"
$CLOUDNS_AUTH_ID
"
_debug CLOUDNS_AUTH_PASSWORD
"
$CLOUDNS_AUTH_PASSWORD
"
data
=
"auth-id=
$CLOUDNS_AUTH_ID
&auth-password=
$CLOUDNS_AUTH_PASSWORD
&
$2
"
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
"
fi
response
=
"
$(
_get
"
$CLOUDNS_API
/
$method
?
$data
"
)
"
...
...
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