NETLIFY: bugfix: append . to records which point to hosts (#1828)

Signed-off-by: Amogh Lele <amolele@gmail.com>
This commit is contained in:
Amogh Lele 2022-11-30 19:53:52 +05:30 committed by GitHub
parent 627108ee03
commit 5b95c099f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,12 +3,14 @@ package netlify
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"strings"
"github.com/StackExchange/dnscontrol/v3/models" "github.com/StackExchange/dnscontrol/v3/models"
"github.com/StackExchange/dnscontrol/v3/pkg/diff" "github.com/StackExchange/dnscontrol/v3/pkg/diff"
"github.com/StackExchange/dnscontrol/v3/pkg/printer" "github.com/StackExchange/dnscontrol/v3/pkg/printer"
"github.com/StackExchange/dnscontrol/v3/pkg/txtutil" "github.com/StackExchange/dnscontrol/v3/pkg/txtutil"
"github.com/StackExchange/dnscontrol/v3/providers" "github.com/StackExchange/dnscontrol/v3/providers"
"strings" "github.com/miekg/dns"
) )
var nameServerSuffixes = []string{ var nameServerSuffixes = []string{
@ -108,8 +110,12 @@ func (n *netlifyProvider) GetZoneRecords(domain string) (models.Records, error)
rec.SetLabelFromFQDN(r.Hostname, domain) // netlify returns the FQDN rec.SetLabelFromFQDN(r.Hostname, domain) // netlify returns the FQDN
if r.Type == "CNAME" || r.Type == "MX" || r.Type == "NS" {
r.Value = dns.CanonicalName(r.Value)
}
switch rtype := r.Type; rtype { switch rtype := r.Type; rtype {
case "NETLIFY", "NETLIFYv6": // these behave similar to a CNAME case "NETLIFY", "NETLIFYv6": // transparently ignore
continue continue
case "MX": case "MX":
err = rec.SetTargetMX(uint16(r.Priority), r.Value) err = rec.SetTargetMX(uint16(r.Priority), r.Value)