NS1: fix ALIAS handling (#1154)

A bug was introduced in a2042c2eda, which stoped ALIAS records
from setting their record type correctly (it was set to nil).

Specifically, case "ALIAS" doesn't fall through to any of the other cases
below, leading ALIAS records to set their type to nil.

To fix that, readd the code that got absorbed by the URLFWD in a2042c2eda.
This commit is contained in:
Costas Drogos 2021-05-11 21:52:27 +02:00 committed by GitHub
parent cf8e288339
commit d8146a4a19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,6 +90,7 @@ func (n *nsone) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Correct
// each name/type is given to the api as a unit.
for k, descs := range changedGroups {
key := k
desc := strings.Join(descs, "\n")
_, current := foundGrouped[k]
recs, wanted := desiredGrouped[k]
@ -165,6 +166,10 @@ func convert(zr *dns.ZoneRecord, domain string) ([]*models.RecordConfig, error)
rec.SetLabelFromFQDN(zr.Domain, domain)
switch rtype := zr.Type; rtype {
case "ALIAS":
rec.Type = rtype
if err := rec.SetTarget(ans); err != nil {
panic(fmt.Errorf("unparsable %s record received from ns1: %w", rtype, err))
}
case "URLFWD":
rec.Type = rtype
if err := rec.SetTarget(ans); err != nil {