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
2f4111a2
Unverified
Commit
2f4111a2
authored
Feb 13, 2017
by
Matthew Turney
Browse files
fixup shellcheck style issues
parent
326ac485
Changes
1
Show whitespace changes
Inline
Side-by-side
dnsapi/dns_dnsimple.sh
View file @
2f4111a2
...
@@ -37,7 +37,7 @@ dns_dnsimple_add() {
...
@@ -37,7 +37,7 @@ dns_dnsimple_add() {
return
1
return
1
fi
fi
_get_records
$_account_id
$_domain
$_sub_domain
_get_records
"
$_account_id
"
"
$_domain
"
"
$_sub_domain
"
if
[
"
$_records_count
"
=
"0"
]
;
then
if
[
"
$_records_count
"
=
"0"
]
;
then
_info
"Adding record"
_info
"Adding record"
...
@@ -53,14 +53,17 @@ dns_dnsimple_add() {
...
@@ -53,14 +53,17 @@ dns_dnsimple_add() {
_err
"Add txt record error."
_err
"Add txt record error."
else
else
_info
"Updating record"
_info
"Updating record"
_extract_record_id
$_records
$_sub_domain
_extract_record_id
"
$_records
"
"
$_sub_domain
"
if
_dnsimple_rest
\
PATCH
\
"
$_account_id
/zones/
$_domain
/records/
$_record_id
"
\
"{
\"
type
\"
:
\"
TXT
\"
,
\"
name
\"
:
\"
$_sub_domain
\"
,
\"
content
\"
:
\"
$txtvalue
\"
,
\"
ttl
\"
:120}"
;
then
_dnsimple_rest PATCH
"
$_account_id
/zones/
$_domain
/records/
$_record_id
"
"{
\"
type
\"
:
\"
TXT
\"
,
\"
name
\"
:
\"
$_sub_domain
\"
,
\"
content
\"
:
\"
$txtvalue
\"
,
\"
ttl
\"
:120}"
if
[
"
$?
"
=
"0"
]
;
then
_info
"Updated!"
_info
"Updated!"
#todo: check if the record takes effect
return
0
return
0
fi
fi
_err
"Update error"
_err
"Update error"
return
1
return
1
fi
fi
...
@@ -80,13 +83,12 @@ dns_dnsimple_rm() {
...
@@ -80,13 +83,12 @@ dns_dnsimple_rm() {
return
1
return
1
fi
fi
_get_records
$_account_id
$_domain
$_sub_domain
_get_records
"
$_account_id
"
"
$_domain
"
"
$_sub_domain
"
_extract_record_id
$_records
$_sub_domain
_extract_record_id
"
$_records
"
"
$_sub_domain
"
if
[
"
$_record_id
"
]
;
then
if
[
"
$_record_id
"
]
;
then
_dnsimple_rest DELETE
"
$_account_id
/zones/
$_domain
/records/
$_record_id
"
if
[
"
$?
"
=
"0"
]
;
then
if
_dnsimple_rest DELETE
"
$_account_id
/zones/
$_domain
/records/
$_record_id
"
;
then
_info
"removed record"
"
$_record_id
"
_info
"removed record"
"
$_record_id
"
return
0
return
0
fi
fi
...
@@ -193,8 +195,9 @@ _dnsimple_rest() {
...
@@ -193,8 +195,9 @@ _dnsimple_rest() {
request_url
=
"
$DNSimple_API
/
$path
"
request_url
=
"
$DNSimple_API
/
$path
"
_debug
"
$path
"
_debug
"
$path
"
_H1
=
"Accept: application/json"
export
_H1
=
"Accept: application/json"
_H2
=
"Authorization: Bearer
$DNSimple_OAUTH_TOKEN
"
export
_H2
=
"Authorization: Bearer
$DNSimple_OAUTH_TOKEN
"
if
[
"
$data
"
]
;
then
if
[
"
$data
"
]
;
then
_H1
=
"Content-Type: application/json"
_H1
=
"Content-Type: application/json"
_debug data
"
$data
"
_debug data
"
$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