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
6445a767
"Makefile.esp8266" did not exist on "669543bbf2dc26ea41f0385c6ee0ced237239d53"
Commit
6445a767
authored
Jul 08, 2017
by
Vladimir Berezhnoy
Browse files
fix syntax
parent
3bf2e89a
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_yandex.sh
View file @
6445a767
...
@@ -16,8 +16,8 @@ dns_yandex_add() {
...
@@ -16,8 +16,8 @@ dns_yandex_add() {
_PDD_credentials
_PDD_credentials
export
_H1
=
"PddToken:
$PDD_Token
"
export
_H1
=
"PddToken:
$PDD_Token
"
curDomain
=
"
$(
echo
${
fulldomain
}
|
awk
-F
.
'{printf("%s.%s\n",$(NF-1), $NF)}'
)
"
curDomain
=
"
$(
echo
"
${
fulldomain
}
"
|
awk
-F
.
'{printf("%s.%s\n",$(NF-1), $NF)}'
)
"
curSubdomain
=
"
$(
echo
${
fulldomain
}
|
sed
-e
's#$curDomain##'
)
"
curSubdomain
=
"
$(
echo
"
${
fulldomain
}
"
|
sed
-e
's#$curDomain##'
)
"
curData
=
"domain=
${
curDomain
}
&type=TXT&subdomain=
${
curSubdomain
}
&ttl=360&content=
${
txtvalue
}
"
curData
=
"domain=
${
curDomain
}
&type=TXT&subdomain=
${
curSubdomain
}
&ttl=360&content=
${
txtvalue
}
"
curUri
=
"https://pddimp.yandex.ru/api2/admin/dns/add"
curUri
=
"https://pddimp.yandex.ru/api2/admin/dns/add"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
curUri
}
"
)
"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
curUri
}
"
)
"
...
@@ -30,10 +30,10 @@ dns_yandex_rm() {
...
@@ -30,10 +30,10 @@ dns_yandex_rm() {
_debug
"Calling: dns_yandex_rm() '
${
fulldomain
}
'"
_debug
"Calling: dns_yandex_rm() '
${
fulldomain
}
'"
_PDD_credentials
_PDD_credentials
export
_H1
=
"PddToken:
$PDD_Token
"
export
_H1
=
"PddToken:
$PDD_Token
"
local
record_id
=
$(
pdd_get_record_id
${
fulldomain
}
)
record_id
=
$(
pdd_get_record_id
${
fulldomain
}
)
curDomain
=
"
$(
echo
${
fulldomain
}
|
awk
-F
.
'{printf("%s.%s\n",$(NF-1), $NF)}'
)
"
curDomain
=
"
$(
echo
"
${
fulldomain
}
"
|
awk
-F
.
'{printf("%s.%s\n",$(NF-1), $NF)}'
)
"
curSubdomain
=
"
$(
echo
${
fulldomain
}
|
sed
-e
's#$curDomain##'
)
"
curSubdomain
=
"
$(
echo
"
${
fulldomain
}
"
|
sed
-e
's#$curDomain##'
)
"
curUri
=
"https://pddimp.yandex.ru/api2/admin/dns/del"
curUri
=
"https://pddimp.yandex.ru/api2/admin/dns/del"
curData
=
"domain=
${
curDomain
}
&record_id=
${
record_id
}
"
curData
=
"domain=
${
curDomain
}
&record_id=
${
record_id
}
"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
curUri
}
"
)
"
curResult
=
"
$(
_post
"
${
curData
}
"
"
${
curUri
}
"
)
"
...
@@ -53,17 +53,17 @@ _PDD_credentials() {
...
@@ -53,17 +53,17 @@ _PDD_credentials() {
}
}
pdd_get_record_id
()
{
pdd_get_record_id
()
{
local
fulldomain
=
"
${
1
}
"
fulldomain
=
"
${
1
}
"
local
curDomain
=
"
$(
echo
${
fulldomain
}
|awk
-F
.
'{printf("%s.%s\n",$(NF-1), $NF)}'
)
"
curDomain
=
"
$(
echo
"
${
fulldomain
}
"
|awk
-F
.
'{printf("%s.%s\n",$(NF-1), $NF)}'
)
"
local
curUri
=
"https://pddimp.yandex.ru/api2/admin/dns/list?domain=
${
curDomain
}
"
curUri
=
"https://pddimp.yandex.ru/api2/admin/dns/list?domain=
${
curDomain
}
"
local
curResult
=
"
$(
_get
"
${
curUri
}
"
)
"
curResult
=
"
$(
_get
"
${
curUri
}
"
)
"
echo
${
curResult
}
|
\
echo
${
curResult
}
|
\
python
-c
'
python
-c
"
import sys, json;
import sys, json;
rs=json.load(sys.stdin)["records"]
rs=json.load(sys.stdin)[
\
"
records
\
"
]
for r in rs:
for r in rs:
if r["fqdn"]=="${fulldomain}":
if r[
\
"
fqdn
\
"
]==
\
"
${
fulldomain
}
\
"
:
print r["record_id"]
print r[
\
"
record_id
\
"
]
exit
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