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

CLOUDNS: fix two integration test failed (#2246)

Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
imlonghao
2023-03-31 19:48:46 +08:00
committed by GitHub
parent f17b34a513
commit 73623f650c
2 changed files with 18 additions and 7 deletions

View File

@@ -21,5 +21,7 @@ func AuditRecords(records []*models.RecordConfig) []error {
a.Add("TXT", rejectif.TxtHasMultipleSegments) // Last verified 2021-03-01
a.Add("SRV", rejectif.SrvHasNullTarget) // Last verified 2023-03-30
return a.Audit(records)
}

View File

@@ -136,7 +136,11 @@ func (c *cloudnsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mode
}
}
var createCorrections []*models.Correction
var (
createCorrections []*models.Correction
createARecordCorrections []*models.Correction
createNSRecordCorrections []*models.Correction
)
for _, m := range create {
req, err := toReq(m.Desired)
if err != nil {
@@ -155,15 +159,20 @@ func (c *cloudnsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mode
return c.createRecord(domainID, req)
},
}
// at ClouDNS, we MUST have a NS for a DS
// So, when creating, we must create the NS first, otherwise creating the DS throws an error
if m.Desired.Type == "NS" {
// type NS is prepended - so executed first
createCorrections = append([]*models.Correction{corr}, createCorrections...)
} else {
// A & AAAA need to be created before NS #2244
// NS need to be created before DS #1018
// or else errors will be thrown
switch m.Desired.Type {
case "A", "AAAA":
createARecordCorrections = append(createARecordCorrections, corr)
case "NS":
createNSRecordCorrections = append(createNSRecordCorrections, corr)
default:
createCorrections = append(createCorrections, corr)
}
}
corrections = append(corrections, createARecordCorrections...)
corrections = append(corrections, createNSRecordCorrections...)
corrections = append(corrections, createCorrections...)
for _, m := range modify {