# To support wildcard certificates, try to find existig TXT record and update it.
_info "Search existing TXT record"
# The TXT record might already exist when working with wilcard certificates. In that case, update the record by adding the new value.
_debug "Search TXT record"
if _constellix_rest GET "domains/${_domain_id}/records/TXT/search?exact=${_sub_domain}";then
if _constellix_rest GET "domains/${_domain_id}/records/TXT/search?exact=${_sub_domain}";then
ifprintf -- "%s""$response"| grep "{\"errors\":\[\"Requested record was not found\"\]}" >/dev/null;then
ifprintf -- "%s""$response"| grep "{\"errors\":\[\"Requested record was not found\"\]}" >/dev/null;then
_info "Adding TXT record"
_info "Adding TXT record"
@ -83,6 +83,13 @@ dns_constellix_rm() {
return1
return1
fi
fi
# The TXT record might have been removed already when working with some wildcard certificates.
_debug "Search TXT record"
if _constellix_rest GET "domains/${_domain_id}/records/TXT/search?exact=${_sub_domain}";then
ifprintf -- "%s""$response"| grep "{\"errors\":\[\"Requested record was not found\"\]}" >/dev/null;then
_info "Removed"
return0
else
_info "Removing TXT record"
_info "Removing TXT record"
if _constellix_rest POST "domains/${_domain_id}/records""[{\"type\":\"txt\",\"delete\":true,\"filter\":{\"field\":\"name\",\"op\":\"eq\",\"value\":\"${_sub_domain}\"}}]";then
if _constellix_rest POST "domains/${_domain_id}/records""[{\"type\":\"txt\",\"delete\":true,\"filter\":{\"field\":\"name\",\"op\":\"eq\",\"value\":\"${_sub_domain}\"}}]";then