Fixed bugs in vultr agent

This commit is contained in:
Eric Renfro 2023-11-01 02:26:13 -04:00
parent cea35faa0e
commit 76ca7315cc
Signed by: psi-jack
GPG key ID: 14977F3A50D9A5BF

View file

@ -82,7 +82,7 @@ _update_dns_vultr_get_record_id() {
-H "Authorization: Bearer $agent_update_dns_vultr_token" \
"https://api.vultr.com/v2/domains/$domain/records?per_page=500")
record_id="$(echo "$response" | jq --arg subdomain "$subdomain" --arg dtype "$dtype" '.records[] | select(.name==$subdomain and .type==$dtype).id')"
record_id="$(sed -e 's/^"//' -e 's/"$//' <<<"$(echo "$response" | jq --arg subdomain "$subdomain" --arg dtype "$dtype" '.records[] | select(.name==$subdomain and .type==$dtype).id')")"
if [[ -z "$record_id" ]]
then
@ -97,7 +97,7 @@ if _update_dns_vultr_check_domain "$DIP_DOMAIN"; then
if valid_ipv4 "$DIP_CUR_IP"; then
log "Updating Vultr DNS IPv4 Record: ${DIP_RECORD}.${DIP_DOMAIN} to ${DIP_CUR_IP}"
if _update_dns_vultr_get_record_id "${DIP_DOMAIN_ID}" "A" "${DIP_RECORD}"
if _update_dns_vultr_get_record_id "${DIP_DOMAIN}" "A" "${DIP_RECORD}"
then
curl --silent \
-X PATCH \
@ -113,7 +113,7 @@ if _update_dns_vultr_check_domain "$DIP_DOMAIN"; then
if valid_ipv6 "$DIP_CUR_IP"; then
log "Updating Linux DNS IPv6 Record: ${DIP_RECORD}.${DIP_DOMAIN} to ${DIP_CUR_IP}"
if _update_dns_vultr_get_record_id "${DIP_DOMAIN_ID}" "AAAA" "${DIP_RECORD}"
if _update_dns_vultr_get_record_id "${DIP_DOMAIN}" "AAAA" "${DIP_RECORD}"
then
curl --silent \
-X PATCH \