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
7588fc09
Unverified
Commit
7588fc09
authored
Mar 26, 2018
by
Chris
Browse files
Fixes DNSimple for Wildcard certificates
parent
aad309ee
Changes
1
Show whitespace changes
Inline
Side-by-side
dnsapi/dns_dnsimple.sh
View file @
7588fc09
...
@@ -39,7 +39,7 @@ dns_dnsimple_add() {
...
@@ -39,7 +39,7 @@ dns_dnsimple_add() {
_get_records
"
$_account_id
"
"
$_domain
"
"
$_sub_domain
"
_get_records
"
$_account_id
"
"
$_domain
"
"
$_sub_domain
"
if
[
"
$_records_count
"
=
"0"
]
;
then
#
if [ "$_records_count" = "0" ]; then
_info
"Adding record"
_info
"Adding record"
if
_dnsimple_rest POST
"
$_account_id
/zones/
$_domain
/records"
"{
\"
type
\"
:
\"
TXT
\"
,
\"
name
\"
:
\"
$_sub_domain
\"
,
\"
content
\"
:
\"
$txtvalue
\"
,
\"
ttl
\"
:120}"
;
then
if
_dnsimple_rest POST
"
$_account_id
/zones/
$_domain
/records"
"{
\"
type
\"
:
\"
TXT
\"
,
\"
name
\"
:
\"
$_sub_domain
\"
,
\"
content
\"
:
\"
$txtvalue
\"
,
\"
ttl
\"
:120}"
;
then
if
printf
--
"%s"
"
$response
"
|
grep
"
\"
name
\"
:
\"
$_sub_domain
\"
"
>
/dev/null
;
then
if
printf
--
"%s"
"
$response
"
|
grep
"
\"
name
\"
:
\"
$_sub_domain
\"
"
>
/dev/null
;
then
...
@@ -51,22 +51,22 @@ dns_dnsimple_add() {
...
@@ -51,22 +51,22 @@ dns_dnsimple_add() {
fi
fi
fi
fi
_err
"Add txt record error."
_err
"Add txt record error."
else
#
else
_info
"Updating record"
#
_info "Updating record"
_extract_record_id
"
$_records
"
"
$_sub_domain
"
#
_extract_record_id "$_records" "$_sub_domain"
if
_dnsimple_rest
\
#
if _dnsimple_rest \
PATCH
\
#
PATCH \
"
$_account_id
/zones/
$_domain
/records/
$_record_id
"
\
#
"$_account_id/zones/$_domain/records/$_record_id" \
"{
\"
type
\"
:
\"
TXT
\"
,
\"
name
\"
:
\"
$_sub_domain
\"
,
\"
content
\"
:
\"
$txtvalue
\"
,
\"
ttl
\"
:120}"
;
then
#
"{\"type\":\"TXT\",\"name\":\"$_sub_domain\",\"content\":\"$txtvalue\",\"ttl\":120}"; then
_info
"Updated!"
#
_info "Updated!"
return
0
#
return 0
fi
#
fi
_err
"Update error"
#
_err "Update error"
return
1
#
return 1
fi
#
fi
}
}
# fulldomain
# fulldomain
...
@@ -84,19 +84,20 @@ dns_dnsimple_rm() {
...
@@ -84,19 +84,20 @@ dns_dnsimple_rm() {
fi
fi
_get_records
"
$_account_id
"
"
$_domain
"
"
$_sub_domain
"
_get_records
"
$_account_id
"
"
$_domain
"
"
$_sub_domain
"
_extract_record_id
"
$_records
"
"
$_sub_domain
"
_extract_record_id
"
$_records
"
"
$_sub_domain
"
if
[
"
$_record_id
"
]
;
then
if
[
"
$_record_id
"
]
;
then
echo
"
$_record_id
"
|
while
read
-r
item
if
_dnsimple_rest DELETE
"
$_account_id
/zones/
$_domain
/records/
$_record_id
"
;
then
do
_info
"removed record"
"
$_record_id
"
if
_dnsimple_rest DELETE
"
$_account_id
/zones/
$_domain
/records/
$item
"
;
then
_info
"removed record"
"
$item
"
return
0
return
0
else
_err
"failed to remove record"
"
$item
"
return
1
fi
fi
done
fi
fi
_err
"failed to remove record"
"
$_record_id
"
return
1
}
}
#################### Private functions bellow ##################################
#################### Private functions bellow ##################################
...
...
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