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
15fa0c26
Commit
15fa0c26
authored
Oct 02, 2020
by
Rene Luria
Committed by
Ed Lynes
Oct 27, 2020
Browse files
dnsapi/dns_infomaniak.sh: Replace grep by _contains
parent
25468f55
Changes
1
Show whitespace changes
Inline
Side-by-side
dnsapi/dns_infomaniak.sh
View file @
15fa0c26
...
@@ -85,7 +85,7 @@ dns_infomaniak_add() {
...
@@ -85,7 +85,7 @@ dns_infomaniak_add() {
# API call
# API call
response
=
$(
_post
"
$data
"
"
${
INFOMANIAK_API_URL
}
/1/domain/
$domain_id
/dns/record"
)
response
=
$(
_post
"
$data
"
"
${
INFOMANIAK_API_URL
}
/1/domain/
$domain_id
/dns/record"
)
if
[
-n
"
$response
"
]
&&
echo
"
$response
"
|
grep
-qF
'"result":"success"'
;
then
if
[
-n
"
$response
"
]
&&
echo
"
$response
"
|
_contains
'"result":"success"'
;
then
_info
"Record added"
_info
"Record added"
_debug
"Response:
$response
"
_debug
"Response:
$response
"
return
0
return
0
...
@@ -165,7 +165,7 @@ dns_infomaniak_rm() {
...
@@ -165,7 +165,7 @@ dns_infomaniak_rm() {
# API call
# API call
response
=
$(
_post
""
"
${
INFOMANIAK_API_URL
}
/1/domain/
$domain_id
/dns/record/
$record_id
"
""
DELETE
)
response
=
$(
_post
""
"
${
INFOMANIAK_API_URL
}
/1/domain/
$domain_id
/dns/record/
$record_id
"
""
DELETE
)
if
[
-n
"
$response
"
]
&&
echo
"
$response
"
|
grep
-qF
'"result":"success"'
;
then
if
[
-n
"
$response
"
]
&&
echo
"
$response
"
|
_contains
'"result":"success"'
;
then
_info
"Record deleted"
_info
"Record deleted"
return
0
return
0
fi
fi
...
@@ -187,7 +187,7 @@ _find_zone() {
...
@@ -187,7 +187,7 @@ _find_zone() {
zone
=
"
$1
"
zone
=
"
$1
"
# find domain in list, removing . parts sequentialy
# find domain in list, removing . parts sequentialy
while
echo
"
$zone
"
|
grep
-q
'\.'
;
do
while
_contains
"
$zone
"
'\.'
;
do
_debug
"testing
$zone
"
_debug
"testing
$zone
"
id
=
$(
_get_domain_id
"
$zone
"
)
id
=
$(
_get_domain_id
"
$zone
"
)
if
[
-n
"
$id
"
]
;
then
if
[
-n
"
$id
"
]
;
then
...
...
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