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
c848d3ee
Commit
c848d3ee
authored
Jul 12, 2017
by
Vladimir Berezhnoy
Browse files
fix formatting
parent
eb6be88f
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_yandex.sh
View file @
c848d3ee
...
@@ -16,7 +16,7 @@ dns_yandex_add() {
...
@@ -16,7 +16,7 @@ dns_yandex_add() {
_PDD_credentials
||
return
1
_PDD_credentials
||
return
1
export
_H1
=
"PddToken:
$PDD_Token
"
export
_H1
=
"PddToken:
$PDD_Token
"
curDomain
=
$(
_PDD_get_domain
$fulldomain
)
curDomain
=
$(
_PDD_get_domain
"
$fulldomain
"
)
_debug
"Found suitable domain in pdd:
$curDomain
"
_debug
"Found suitable domain in pdd:
$curDomain
"
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
}
"
...
@@ -34,7 +34,7 @@ dns_yandex_rm() {
...
@@ -34,7 +34,7 @@ dns_yandex_rm() {
record_id
=
$(
pdd_get_record_id
"
${
fulldomain
}
"
)
record_id
=
$(
pdd_get_record_id
"
${
fulldomain
}
"
)
_debug
"Result:
$record_id
"
_debug
"Result:
$record_id
"
curDomain
=
$(
_PDD_get_domain
$fulldomain
)
curDomain
=
$(
_PDD_get_domain
"
$fulldomain
"
)
_debug
"Found suitable domain in pdd:
$curDomain
"
_debug
"Found suitable domain in pdd:
$curDomain
"
curSubdomain
=
"
$(
echo
"
${
fulldomain
}
"
|
sed
-e
"s@.
${
curDomain
}
\$
@@"
)
"
curSubdomain
=
"
$(
echo
"
${
fulldomain
}
"
|
sed
-e
"s@.
${
curDomain
}
\$
@@"
)
"
...
@@ -52,11 +52,11 @@ _PDD_get_domain() {
...
@@ -52,11 +52,11 @@ _PDD_get_domain() {
__last
=
0
__last
=
0
while
[
$__last
-eq
0
]
;
do
while
[
$__last
-eq
0
]
;
do
uri1
=
"https://pddimp.yandex.ru/api2/admin/domain/domains?page=
${
__page
}
&on_page=20"
uri1
=
"https://pddimp.yandex.ru/api2/admin/domain/domains?page=
${
__page
}
&on_page=20"
res1
=
$(
_get
$uri1
| _normalizeJson
)
res1
=
$(
_get
"
$uri1
"
| _normalizeJson
)
#_debug "$res1"
#_debug "$res1"
__found
=
$(
echo
"
$res1
"
|
sed
-n
-e
's#.* "found": \([^,]*\),.*#\1#p'
)
__found
=
$(
echo
"
$res1
"
|
sed
-n
-e
's#.* "found": \([^,]*\),.*#\1#p'
)
_debug
"found:
$__found
results on page"
_debug
"found:
$__found
results on page"
if
[
$__found
-lt
20
]
;
then
if
[
"
$__found
"
-lt
20
]
;
then
_debug
"last page:
$__page
"
_debug
"last page:
$__page
"
__last
=
1
__last
=
1
fi
fi
...
@@ -71,7 +71,7 @@ _PDD_get_domain() {
...
@@ -71,7 +71,7 @@ _PDD_get_domain() {
__t
=
$(
echo
"
$fulldomain
"
|
cut
-d
.
-f
$k
-100
)
__t
=
$(
echo
"
$fulldomain
"
|
cut
-d
.
-f
$k
-100
)
_debug
"finding zone for domain
$__t
"
_debug
"finding zone for domain
$__t
"
for
d
in
$__all_domains
;
do
for
d
in
$__all_domains
;
do
if
[
"
$d
"
=
=
"
$__t
"
]
;
then
if
[
"
$d
"
=
"
$__t
"
]
;
then
echo
"
$__t
"
echo
"
$__t
"
return
return
fi
fi
...
@@ -96,7 +96,7 @@ _PDD_credentials() {
...
@@ -96,7 +96,7 @@ _PDD_credentials() {
pdd_get_record_id
()
{
pdd_get_record_id
()
{
fulldomain
=
"
${
1
}
"
fulldomain
=
"
${
1
}
"
curDomain
=
$(
_PDD_get_domain
$fulldomain
)
curDomain
=
$(
_PDD_get_domain
"
$fulldomain
"
)
_debug
"Found suitable domain in pdd:
$curDomain
"
_debug
"Found suitable domain in pdd:
$curDomain
"
curSubdomain
=
"
$(
echo
"
${
fulldomain
}
"
|
sed
-e
"s@.
${
curDomain
}
\$
@@"
)
"
curSubdomain
=
"
$(
echo
"
${
fulldomain
}
"
|
sed
-e
"s@.
${
curDomain
}
\$
@@"
)
"
...
...
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