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
babe884b
Commit
babe884b
authored
Jul 08, 2017
by
Lonnie Abelbeck
Browse files
Replace 'head -n' with the '_head_n' function
parent
528d2f29
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_dyn.sh
View file @
babe884b
...
@@ -156,13 +156,13 @@ _dyn_get_authtoken() {
...
@@ -156,13 +156,13 @@ _dyn_get_authtoken() {
export
_H1
=
"Content-Type: application/json"
export
_H1
=
"Content-Type: application/json"
response
=
"
$(
_post
"
$data
"
"
$dyn_url
"
""
"
$method
"
)
"
response
=
"
$(
_post
"
$data
"
"
$dyn_url
"
""
"
$method
"
)
"
sessionstatus
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
'"status" *: *"[^"]*'
|
head
-
n
1 |
sed
's#^"status" *: *"##'
)
"
sessionstatus
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
'"status" *: *"[^"]*'
|
_
head
_
n 1 |
sed
's#^"status" *: *"##'
)
"
_debug response
"
$response
"
_debug response
"
$response
"
_debug sessionstatus
"
$sessionstatus
"
_debug sessionstatus
"
$sessionstatus
"
if
[
"
$sessionstatus
"
=
"success"
]
;
then
if
[
"
$sessionstatus
"
=
"success"
]
;
then
_dyn_authtoken
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
'"token" *: *"[^"]*'
|
head
-
n
1 |
sed
's#^"token" *: *"##'
)
"
_dyn_authtoken
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
'"token" *: *"[^"]*'
|
_
head
_
n 1 |
sed
's#^"token" *: *"##'
)
"
_info
"Token received"
_info
"Token received"
_debug _dyn_authtoken
"
$_dyn_authtoken
"
_debug _dyn_authtoken
"
$_dyn_authtoken
"
return
0
return
0
...
@@ -190,7 +190,7 @@ _dyn_get_zone() {
...
@@ -190,7 +190,7 @@ _dyn_get_zone() {
export
_H2
=
"Content-Type: application/json"
export
_H2
=
"Content-Type: application/json"
response
=
"
$(
_get
"
$dyn_url
"
""
""
)
"
response
=
"
$(
_get
"
$dyn_url
"
""
""
)
"
sessionstatus
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
'"status" *: *"[^"]*'
|
head
-
n
1 |
sed
's#^"status" *: *"##'
)
"
sessionstatus
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
'"status" *: *"[^"]*'
|
_
head
_
n 1 |
sed
's#^"status" *: *"##'
)
"
_debug dyn_url
"
$dyn_url
"
_debug dyn_url
"
$dyn_url
"
_debug response
"
$response
"
_debug response
"
$response
"
...
@@ -221,7 +221,7 @@ _dyn_add_record() {
...
@@ -221,7 +221,7 @@ _dyn_add_record() {
export
_H2
=
"Content-Type: application/json"
export
_H2
=
"Content-Type: application/json"
response
=
"
$(
_post
"
$data
"
"
$dyn_url
"
""
"
$method
"
)
"
response
=
"
$(
_post
"
$data
"
"
$dyn_url
"
""
"
$method
"
)
"
sessionstatus
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
'"status" *: *"[^"]*'
|
head
-
n
1 |
sed
's#^"status" *: *"##'
)
"
sessionstatus
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
'"status" *: *"[^"]*'
|
_
head
_
n 1 |
sed
's#^"status" *: *"##'
)
"
_debug response
"
$response
"
_debug response
"
$response
"
_debug sessionstatus
"
$sessionstatus
"
_debug sessionstatus
"
$sessionstatus
"
...
@@ -248,7 +248,7 @@ _dyn_publish_zone() {
...
@@ -248,7 +248,7 @@ _dyn_publish_zone() {
export
_H2
=
"Content-Type: application/json"
export
_H2
=
"Content-Type: application/json"
response
=
"
$(
_post
"
$data
"
"
$dyn_url
"
""
"
$method
"
)
"
response
=
"
$(
_post
"
$data
"
"
$dyn_url
"
""
"
$method
"
)
"
sessionstatus
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
'"status" *: *"[^"]*'
|
head
-
n
1 |
sed
's#^"status" *: *"##'
)
"
sessionstatus
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
'"status" *: *"[^"]*'
|
_
head
_
n 1 |
sed
's#^"status" *: *"##'
)
"
_debug response
"
$response
"
_debug response
"
$response
"
_debug sessionstatus
"
$sessionstatus
"
_debug sessionstatus
"
$sessionstatus
"
...
@@ -273,13 +273,13 @@ _dyn_get_record_id() {
...
@@ -273,13 +273,13 @@ _dyn_get_record_id() {
export
_H2
=
"Content-Type: application/json"
export
_H2
=
"Content-Type: application/json"
response
=
"
$(
_get
"
$dyn_url
"
""
""
)
"
response
=
"
$(
_get
"
$dyn_url
"
""
""
)
"
sessionstatus
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
'"status" *: *"[^"]*'
|
head
-
n
1 |
sed
's#^"status" *: *"##'
)
"
sessionstatus
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
'"status" *: *"[^"]*'
|
_
head
_
n 1 |
sed
's#^"status" *: *"##'
)
"
_debug response
"
$response
"
_debug response
"
$response
"
_debug sessionstatus
"
$sessionstatus
"
_debug sessionstatus
"
$sessionstatus
"
if
[
"
$sessionstatus
"
=
"success"
]
;
then
if
[
"
$sessionstatus
"
=
"success"
]
;
then
_dyn_record_id
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
data
\"
*: *
\[\"
/REST/TXTRecord/
$_dyn_zone
/
$fulldomain
/[^
\"
]*"
|
head
-
n
1 |
sed
"s#^
\"
data
\"
*: *
\[\"
/REST/TXTRecord/
$_dyn_zone
/
$fulldomain
/##"
)
"
_dyn_record_id
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
data
\"
*: *
\[\"
/REST/TXTRecord/
$_dyn_zone
/
$fulldomain
/[^
\"
]*"
|
_
head
_
n 1 |
sed
"s#^
\"
data
\"
*: *
\[\"
/REST/TXTRecord/
$_dyn_zone
/
$fulldomain
/##"
)
"
_debug _dyn_record_id
"
$_dyn_record_id
"
_debug _dyn_record_id
"
$_dyn_record_id
"
return
0
return
0
fi
fi
...
@@ -303,7 +303,7 @@ _dyn_rm_record() {
...
@@ -303,7 +303,7 @@ _dyn_rm_record() {
export
_H2
=
"Content-Type: application/json"
export
_H2
=
"Content-Type: application/json"
response
=
"
$(
_post
""
"
$dyn_url
"
""
"
$method
"
)
"
response
=
"
$(
_post
""
"
$dyn_url
"
""
"
$method
"
)
"
sessionstatus
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
'"status" *: *"[^"]*'
|
head
-
n
1 |
sed
's#^"status" *: *"##'
)
"
sessionstatus
=
"
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
'"status" *: *"[^"]*'
|
_
head
_
n 1 |
sed
's#^"status" *: *"##'
)
"
_debug response
"
$response
"
_debug response
"
$response
"
_debug sessionstatus
"
$sessionstatus
"
_debug sessionstatus
"
$sessionstatus
"
...
...
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