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
d51c3838
Unverified
Commit
d51c3838
authored
Jan 24, 2018
by
martgras
Committed by
GitHub
Jan 24, 2018
Browse files
remove unused code and fix error handling
parent
f7d4698e
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_azure.sh
View file @
d51c3838
...
@@ -77,6 +77,7 @@ dns_azure_add()
...
@@ -77,6 +77,7 @@ dns_azure_add()
_info
"validation record added"
_info
"validation record added"
else
else
_err
"error adding validation record (
$_code
)"
_err
"error adding validation record (
$_code
)"
return
1
fi
fi
}
}
...
@@ -149,6 +150,7 @@ dns_azure_rm()
...
@@ -149,6 +150,7 @@ dns_azure_rm()
_info
"validation record removed"
_info
"validation record removed"
else
else
_err
"error removing validation record (
$_code
)"
_err
"error removing validation record (
$_code
)"
return
1
fi
fi
}
}
...
@@ -160,15 +162,11 @@ _azure_rest() {
...
@@ -160,15 +162,11 @@ _azure_rest() {
data
=
"
$3
"
data
=
"
$3
"
accesstoken
=
"
$4
"
accesstoken
=
"
$4
"
_debug
"
$ep
"
export
_H1
=
"authorization: Bearer
$accesstoken
"
export
_H1
=
"authorization: Bearer
$accesstoken
"
export
_H2
=
"accept: application/json"
export
_H2
=
"accept: application/json"
export
_H3
=
"Content-Type: application/json"
export
_H3
=
"Content-Type: application/json"
_H1
=
"authorization: Bearer
$accesstoken
"
_H2
=
"accept: application/json"
_debug
"
$ep
"
_H3
=
"Content-Type: application/json"
if
[
"
$m
"
!=
"GET"
]
;
then
if
[
"
$m
"
!=
"GET"
]
;
then
_debug data
"
$data
"
_debug data
"
$data
"
response
=
"
$(
_post
"
$data
"
"
$ep
"
""
"
$m
"
)
"
response
=
"
$(
_post
"
$data
"
"
$ep
"
""
"
$m
"
)
"
...
@@ -195,7 +193,6 @@ _azure_getaccess_token() {
...
@@ -195,7 +193,6 @@ _azure_getaccess_token() {
export
_H1
=
"accept: application/json"
export
_H1
=
"accept: application/json"
export
_H2
=
"Content-Type: application/x-www-form-urlencoded"
export
_H2
=
"Content-Type: application/x-www-form-urlencoded"
export
_H3
=
""
body
=
"resource=
$(
printf
"%s"
'https://management.core.windows.net/'
| _url_encode
)
&client_id=
$(
printf
"%s"
$clientID
| _url_encode
)
&client_secret=
$(
printf
"%s"
$clientSecret
| _url_encode
)
&grant_type=client_credentials"
body
=
"resource=
$(
printf
"%s"
'https://management.core.windows.net/'
| _url_encode
)
&client_id=
$(
printf
"%s"
$clientID
| _url_encode
)
&client_secret=
$(
printf
"%s"
$clientSecret
| _url_encode
)
&grant_type=client_credentials"
_debug data
"
$body
"
_debug data
"
$body
"
...
@@ -203,7 +200,7 @@ _azure_getaccess_token() {
...
@@ -203,7 +200,7 @@ _azure_getaccess_token() {
accesstoken
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
access_token
\"
:
\"
[^
\"
]*
\"
"
|
head
-n
1 |
cut
-d
:
-f
2 |
tr
-d
\"
)
accesstoken
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
access_token
\"
:
\"
[^
\"
]*
\"
"
|
head
-n
1 |
cut
-d
:
-f
2 |
tr
-d
\"
)
_debug2
"response
$response
"
_debug2
"response
$response
"
if
[
-
Z
"
$accesstoken
"
]
;
then
if
[
-
z
"
$accesstoken
"
]
;
then
_err
"no acccess token received"
_err
"no acccess token received"
return
1
return
1
fi
fi
...
...
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