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
ffa5472b
Unverified
Commit
ffa5472b
authored
Oct 16, 2019
by
rserpent
Committed by
GitHub
Oct 16, 2019
Browse files
fix whitespaces
parent
e00f0b4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_nic.sh
View file @
ffa5472b
...
@@ -79,7 +79,7 @@ dns_nic_rm() {
...
@@ -79,7 +79,7 @@ dns_nic_rm() {
_err
"Invalid domain"
_err
"Invalid domain"
return
1
return
1
fi
fi
_debug _sub_domain
"
$_sub_domain
"
_debug _sub_domain
"
$_sub_domain
"
_debug _domain
"
$_domain
"
_debug _domain
"
$_domain
"
_debug _service
"
$_service
"
_debug _service
"
$_service
"
...
@@ -129,28 +129,28 @@ _get_root() {
...
@@ -129,28 +129,28 @@ _get_root() {
p
=
1
p
=
1
if
!
_nic_rest GET
"zones"
;
then
if
!
_nic_rest GET
"zones"
;
then
return
1
return
1
fi
fi
_all_domains
=
$(
printf
"%s"
"
$response
"
|
grep
"idn-name"
|
sed
-r
"s/.*idn-name=
\"
(.*)
\"
name=.*/
\1
/g"
)
_all_domains
=
$(
printf
"%s"
"
$response
"
|
grep
"idn-name"
|
sed
-r
"s/.*idn-name=
\"
(.*)
\"
name=.*/
\1
/g"
)
_debug2 _all_domains
"
$_all_domains
"
_debug2 _all_domains
"
$_all_domains
"
while
true
;
do
while
true
;
do
h
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
"
$i
"
-100
)
h
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
"
$i
"
-100
)
_debug h
"
$h
"
_debug h
"
$h
"
if
[
-z
"
$h
"
]
;
then
if
[
-z
"
$h
"
]
;
then
return
1
return
1
fi
fi
if
_contains
"
$_all_domains
"
"^
$h
$"
;
then
if
_contains
"
$_all_domains
"
"^
$h
$"
;
then
_sub_domain
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
1-
$p
)
_sub_domain
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
1-
$p
)
_domain
=
$h
_domain
=
$h
_service
=
$(
printf
"%s"
"
$response
"
|
grep
"
$_domain
"
|
sed
-r
"s/.*service=
\"
(.*)
\"
.*
$/
\1
/"
)
_service
=
$(
printf
"%s"
"
$response
"
|
grep
"
$_domain
"
|
sed
-r
"s/.*service=
\"
(.*)
\"
.*
$/
\1
/"
)
return
0
return
0
fi
fi
p
=
"
$i
"
p
=
"
$i
"
i
=
$(
_math
"
$i
"
+ 1
)
i
=
$(
_math
"
$i
"
+ 1
)
done
done
return
1
return
1
}
}
...
@@ -165,20 +165,20 @@ _nic_rest() {
...
@@ -165,20 +165,20 @@ _nic_rest() {
export
_H2
=
"Authorization: Bearer
$_auth_token
"
export
_H2
=
"Authorization: Bearer
$_auth_token
"
if
[
"
$m
"
!=
"GET"
]
;
then
if
[
"
$m
"
!=
"GET"
]
;
then
_debug data
"
$data
"
_debug data
"
$data
"
response
=
$(
_post
"
$data
"
"
$NIC_Api
/dns-master/
$ep
"
""
"
$m
"
)
response
=
$(
_post
"
$data
"
"
$NIC_Api
/dns-master/
$ep
"
""
"
$m
"
)
else
else
response
=
$(
_get
"
$NIC_Api
/dns-master/
$ep
"
)
response
=
$(
_get
"
$NIC_Api
/dns-master/
$ep
"
)
fi
fi
if
_contains
"
$response
"
"<errors>"
;
then
if
_contains
"
$response
"
"<errors>"
;
then
error
=
$(
printf
"%s"
"
$response
"
|
grep
"error code"
|
sed
-r
"s/.*<error code=.*>(.*)<
\/
error>/
\1
/g"
)
error
=
$(
printf
"%s"
"
$response
"
|
grep
"error code"
|
sed
-r
"s/.*<error code=.*>(.*)<
\/
error>/
\1
/g"
)
_err
"Error:
$error
"
_err
"Error:
$error
"
return
1
return
1
fi
fi
if
!
_contains
"
$response
"
"<status>success</status>"
;
then
if
!
_contains
"
$response
"
"<status>success</status>"
;
then
return
1
return
1
fi
fi
_debug2 response
"
$response
"
_debug2 response
"
$response
"
return
0
return
0
...
...
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