diff --git a/src/agents.d/update-dns-vultr b/src/agents.d/update-dns-vultr index 24bbb7a..7b782a4 100755 --- a/src/agents.d/update-dns-vultr +++ b/src/agents.d/update-dns-vultr @@ -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 \