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
e75b5607
Commit
e75b5607
authored
Dec 11, 2017
by
MaomiHz
Browse files
Fix digitalocean api not remove record
parent
9f80909f
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_dgon.sh
View file @
e75b5607
...
@@ -92,11 +92,11 @@ dns_dgon_rm() {
...
@@ -92,11 +92,11 @@ dns_dgon_rm() {
domain_list
=
"
$(
_get
"
$GURL
"
)
"
domain_list
=
"
$(
_get
"
$GURL
"
)
"
## 2) find record
## 2) find record
## check for what we are looing for: "type":"A","name":"$_sub_domain"
## check for what we are looing for: "type":"A","name":"$_sub_domain"
record
=
"
$(
echo
"
$domain_list
"
| _egrep_o
"
\"
id
\"\s
*
\:\s
*
\"
*
\d
+
\"
*[^}]*
\"
name
\"\s
*
\:\s
*
\"
$_sub_domain
\"
[^}]*
\"
data
\"\s
*
\:\s
*
\"
$txtvalue
\"
"
)
"
record
=
"
$(
echo
"
$domain_list
"
| _egrep_o
"
\"
id
\"\s
*
\:\s
*
\"
*
[[:digit:]]
+
\"
*[^}]*
\"
name
\"\s
*
\:\s
*
\"
$_sub_domain
\"
[^}]*
\"
data
\"\s
*
\:\s
*
\"
$txtvalue
\"
"
)
"
## 3) check record and get next page
## 3) check record and get next page
if
[
-z
"
$record
"
]
;
then
if
[
-z
"
$record
"
]
;
then
## find the next page if we dont have a match
## find the next page if we dont have a match
nextpage
=
"
$(
echo
"
$domain_list
"
| _egrep_o
"
\"
links
\"
.*"
| _egrep_o
"
\"
next
\"
.*"
| _egrep_o
"http.*page
\=
\d
+"
)
"
nextpage
=
"
$(
echo
"
$domain_list
"
| _egrep_o
"
\"
links
\"
.*"
| _egrep_o
"
\"
next
\"
.*"
| _egrep_o
"http.*page
\=
[[:digit:]]
+"
)
"
if
[
-z
"
$nextpage
"
]
;
then
if
[
-z
"
$nextpage
"
]
;
then
_err
"no record and no nextpage in digital ocean DNS removal"
_err
"no record and no nextpage in digital ocean DNS removal"
return
1
return
1
...
@@ -108,7 +108,7 @@ dns_dgon_rm() {
...
@@ -108,7 +108,7 @@ dns_dgon_rm() {
done
done
## we found the record
## we found the record
rec_id
=
"
$(
echo
"
$record
"
| _egrep_o
"id
\"\s
*
\:\s
*
\"
*
\d
+"
| _egrep_o
"
\d
+"
)
"
rec_id
=
"
$(
echo
"
$record
"
| _egrep_o
"id
\"\s
*
\:\s
*
\"
*
[[:digit:]]
+"
| _egrep_o
"
[[:digit:]]
+"
)
"
_debug rec_id
"
$rec_id
"
_debug rec_id
"
$rec_id
"
## delete the record
## delete the record
...
...
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