1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

CHORE: Eliminate SetTargetTXTString() (#2409)

This commit is contained in:
Tom Limoncelli
2023-06-01 13:11:36 -04:00
committed by GitHub
parent 23ba49e753
commit ce89f7fb96
5 changed files with 51 additions and 54 deletions

View File

@@ -300,8 +300,16 @@ func nativeToRecord(set *gdns.ResourceRecordSet, rec, origin string) (*models.Re
r := &models.RecordConfig{}
r.SetLabelFromFQDN(set.Name, origin)
r.TTL = uint32(set.Ttl)
if err := r.PopulateFromString(set.Type, rec, origin); err != nil {
return nil, fmt.Errorf("unparsable record received from GCLOUD: %w", err)
rtype := set.Type
var err error
switch rtype {
case "TXT":
err = r.SetTargetTXTs(models.ParseQuotedTxt(rec))
default:
err = r.PopulateFromString(rtype, rec, origin)
}
if err != nil {
return nil, fmt.Errorf("unparsable record %q received from GCLOUD: %w", rtype, err)
}
return r, nil
}