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
494a6e60
Commit
494a6e60
authored
Mar 10, 2021
by
wout
Browse files
Fix checks
parent
89bb7e6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_constellix.sh
View file @
494a6e60
...
...
@@ -38,7 +38,7 @@ dns_constellix_add() {
if
_constellix_rest POST
"domains/
${
_domain_id
}
/records"
"[{
\"
type
\"
:
\"
txt
\"
,
\"
add
\"
:true,
\"
set
\"
:{
\"
name
\"
:
\"
${
_sub_domain
}
\"
,
\"
ttl
\"
:60,
\"
roundRobin
\"
:[{
\"
value
\"
:
\"
${
txtvalue
}
\"
}]}}]"
;
then
if
printf
--
"%s"
"
$response
"
|
grep
"{
\"
success
\"
:
\"
1 record(s) added, 0 record(s) updated, 0 record(s) deleted
\"
}"
>
/dev/null
;
then
_info
"Added"
return
0
return
0
else
_err
"Error adding TXT record"
fi
...
...
@@ -47,7 +47,7 @@ dns_constellix_add() {
_record_id
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
id
\"
:[0-9]+"
|
cut
-d
':'
-f
2
)
if
_constellix_rest GET
"domains/
${
_domain_id
}
/records/TXT/
${
_record_id
}
"
;
then
_new_rr_values
=
$(
printf
"%s
\n
"
"
$response
"
| _egrep_o
"
\"
roundRobin
\"
:
\[
.*?
\]
"
|
sed
"s/
\]
$/
,{
\"
value
\"
:
\"
${
txtvalue
}
\"
}]/"
)
_debug _new_rr_values
$_new_rr_values
_debug _new_rr_values
"
$_new_rr_values
"
_info
"Updating TXT record"
if
_constellix_rest PUT
"domains/
${
_domain_id
}
/records/TXT/
${
_record_id
}
"
"{
\"
name
\"
:
\"
${
_sub_domain
}
\"
,
\"
ttl
\"
:60,
${
_new_rr_values
}
}"
;
then
if
printf
--
"%s"
"
$response
"
|
grep
"{
\"
success
\"
:
\"
Record.*updated successfully
\"
}"
>
/dev/null
;
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