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
893917a2
Unverified
Commit
893917a2
authored
Mar 22, 2018
by
Nils Sandmann
Browse files
Fix travis errors
parent
af5ff2bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_pdns.sh
View file @
893917a2
...
...
@@ -91,14 +91,12 @@ set_record() {
new_challenge
=
$3
_pdns_rest
"GET"
"/api/v1/servers/
$PDNS_ServerId
/zones/
$root
"
_existing_challenges
=(
$(
echo
"
$response
"
| _normalizeJson |
grep
-Po
"
\"
name
\"
:
\"
$fulldomain
\K
.*?}]"
|
grep
-Po
'content\":\"\\"\K[^\\]*'
)
)
_record_string
=
""
_build_record_string
$new_challenge
for
i
in
"
${
_existing_challenges
[@]
}
"
do
_record_string+
=
", "
_build_record_string
$i
_build_record_string
"
$new_challenge
"
_existing_challenges
=
$(
echo
"
$response
"
| _normalizeJson |
grep
-Po
"
\"
name
\"
:
\"
$fulldomain
\\
K.*?}]"
|
grep
-Po
'content\":\"\\"\K[^\\]*'
)
for
oldchallenge
in
$_existing_challenges
;
do
_record_string
=
"
${
_record_string
}
, "
_build_record_string
"
$oldchallenge
"
done
if
!
_pdns_rest
"PATCH"
"/api/v1/servers/
$PDNS_ServerId
/zones/
$root
"
"{
\"
rrsets
\"
: [{
\"
changetype
\"
:
\"
REPLACE
\"
,
\"
name
\"
:
\"
$full
.
\"
,
\"
type
\"
:
\"
TXT
\"
,
\"
ttl
\"
:
$PDNS_Ttl
,
\"
records
\"
: [
$_record_string
]}]}"
;
then
...
...
@@ -106,10 +104,6 @@ set_record() {
return
1
fi
if
!
notify_slaves
"
$root
"
;
then
return
1
fi
return
0
}
...
...
@@ -198,5 +192,5 @@ _pdns_rest() {
}
_build_record_string
()
{
_record_string
+
=
"{
\"
content
\"
:
\"\\\"
$1
\\\"\"
,
\"
disabled
\"
: false}"
_record_string
=
"
${
_record_string
}
{
\"
content
\"
:
\"\\\"
$1
\\\"\"
,
\"
disabled
\"
: false}"
}
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