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
fceb7285
Commit
fceb7285
authored
Jul 11, 2017
by
Vladimir Berezhnoy
Browse files
fix egrep and exit
parent
a0df4625
Changes
1
Show whitespace changes
Inline
Side-by-side
dnsapi/dns_yandex.sh
View file @
fceb7285
...
@@ -13,7 +13,7 @@ dns_yandex_add() {
...
@@ -13,7 +13,7 @@ dns_yandex_add() {
fulldomain
=
"
${
1
}
"
fulldomain
=
"
${
1
}
"
txtvalue
=
"
${
2
}
"
txtvalue
=
"
${
2
}
"
_debug
"Calling: dns_yandex_add() '
${
fulldomain
}
' '
${
txtvalue
}
'"
_debug
"Calling: dns_yandex_add() '
${
fulldomain
}
' '
${
txtvalue
}
'"
_PDD_credentials
||
exit
1
_PDD_credentials
||
return
1
export
_H1
=
"PddToken:
$PDD_Token
"
export
_H1
=
"PddToken:
$PDD_Token
"
curDomain
=
"
$(
echo
"
${
fulldomain
}
"
| rev |
cut
-d
.
-f
1-2 | rev
)
"
curDomain
=
"
$(
echo
"
${
fulldomain
}
"
| rev |
cut
-d
.
-f
1-2 | rev
)
"
...
@@ -28,7 +28,7 @@ dns_yandex_add() {
...
@@ -28,7 +28,7 @@ dns_yandex_add() {
dns_yandex_rm
()
{
dns_yandex_rm
()
{
fulldomain
=
"
${
1
}
"
fulldomain
=
"
${
1
}
"
_debug
"Calling: dns_yandex_rm() '
${
fulldomain
}
'"
_debug
"Calling: dns_yandex_rm() '
${
fulldomain
}
'"
_PDD_credentials
||
exit
1
_PDD_credentials
||
return
1
export
_H1
=
"PddToken:
$PDD_Token
"
export
_H1
=
"PddToken:
$PDD_Token
"
record_id
=
$(
pdd_get_record_id
"
${
fulldomain
}
"
)
record_id
=
$(
pdd_get_record_id
"
${
fulldomain
}
"
)
_debug
"Result:
$record_id
"
_debug
"Result:
$record_id
"
...
@@ -60,5 +60,5 @@ pdd_get_record_id() {
...
@@ -60,5 +60,5 @@ pdd_get_record_id() {
curUri
=
"https://pddimp.yandex.ru/api2/admin/dns/list?domain=
${
curDomain
}
"
curUri
=
"https://pddimp.yandex.ru/api2/admin/dns/list?domain=
${
curDomain
}
"
curResult
=
"
$(
_get
"
${
curUri
}
"
| _normalizeJson
)
"
curResult
=
"
$(
_get
"
${
curUri
}
"
| _normalizeJson
)
"
_debug
"Result:
$curResult
"
_debug
"Result:
$curResult
"
echo
"
$curResult
"
|
grep
-
o
"{[^{]*
\"
content
\"
:[^{]*
\"
subdomain
\"
:
\"
${
curSubdomain
}
\"
"
|
sed
-n
-e
's#.* "record_id": \(.*\),[^,]*#\1#p'
echo
"
$curResult
"
|
_e
grep
_
o
"{[^{]*
\"
content
\"
:[^{]*
\"
subdomain
\"
:
\"
${
curSubdomain
}
\"
"
|
sed
-n
-e
's#.* "record_id": \(.*\),[^,]*#\1#p'
}
}
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