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
266e9d06
Commit
266e9d06
authored
Jul 09, 2017
by
Vladimir Berezhnoy
Browse files
remove python
parent
9ec54ef8
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_yandex.sh
View file @
266e9d06
...
@@ -31,6 +31,7 @@ dns_yandex_rm() {
...
@@ -31,6 +31,7 @@ dns_yandex_rm() {
_PDD_credentials
||
exit
1
_PDD_credentials
||
exit
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
"
curDomain
=
"
$(
echo
"
${
fulldomain
}
"
| rev |
cut
-d
.
-f
1-2 | rev
)
"
curDomain
=
"
$(
echo
"
${
fulldomain
}
"
| rev |
cut
-d
.
-f
1-2 | rev
)
"
curSubdomain
=
"
$(
echo
"
${
fulldomain
}
"
| rev |
cut
-d
.
-f
3- | rev
)
"
curSubdomain
=
"
$(
echo
"
${
fulldomain
}
"
| rev |
cut
-d
.
-f
3- | rev
)
"
...
@@ -54,16 +55,10 @@ _PDD_credentials() {
...
@@ -54,16 +55,10 @@ _PDD_credentials() {
pdd_get_record_id
()
{
pdd_get_record_id
()
{
fulldomain
=
"
${
1
}
"
fulldomain
=
"
${
1
}
"
curDomain
=
"
$(
echo
"
${
fulldomain
}
"
|
awk
-F
.
'{printf("%s.%s\n",$(NF-1), $NF)}'
)
"
curDomain
=
"
$(
echo
"
${
fulldomain
}
"
| rev |
cut
-d
.
-f
1-2 | rev
)
"
curSubdomain
=
"
$(
echo
"
${
fulldomain
}
"
| rev |
cut
-d
.
-f
3- | rev
)
"
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
}
"
)
"
curResult
=
"
$(
_get
"
${
curUri
}
"
| _normalizeJson
)
"
echo
"
${
curResult
}
"
\
_debug
"Result:
$curResult
"
| python
-c
"
echo
"
$curResult
"
|
grep
-o
"{[^{]*
\"
content
\"
:[^{]*
\"
subdomain
\"
:
\"
${
curSubdomain
}
\"
"
|
sed
-n
-e
's#.* "record_id": \(.*\),[^,]*#\1#p'
import sys, json;
rs=json.load(sys.stdin)[
\"
records
\"
]
for r in rs:
if r[
\"
fqdn
\"
]==
\"
${
fulldomain
}
\"
:
print r[
\"
record_id
\"
]
exit
"
}
}
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