ROUTE53: Fix "No such DNS type error" on legacy or ignored records (#2294)

Co-authored-by: Tom Limoncelli <tal@whatexit.org>
This commit is contained in:
Tom Limoncelli 2023-05-01 18:33:29 -04:00 committed by GitHub
parent d8e167c2ce
commit 8f4a08a7e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 3 deletions

View file

@ -1543,6 +1543,19 @@ func makeTests(t *testing.T) []*TestGroup {
),
),
// Bug https://github.com/StackExchange/dnscontrol/issues/2285
testgroup("R53_alias pre-existing",
requires(providers.CanUseRoute53Alias),
tc("Create some records",
r53alias("dev-system", "CNAME", "dev-system18.**current-domain**"),
cname("dev-system18", "ec2-54-91-33-155.compute-1.amazonaws.com."),
),
tc("Add a new record - ignoring foo",
a("bar", "1.2.3.4"),
ignoreName("dev-system*"),
),
),
// CLOUDFLAREAPI features
testgroup("CF_REDIRECT",

View file

@ -86,6 +86,8 @@ func (rc *RecordConfig) zoneFileQuoted() string {
// GetTargetRFC1035Quoted returns the target as it would be in an
// RFC1035-style zonefile.
// Do not use this function if RecordConfig might be a pseudo-rtype
// such as R53_ALIAS. Use GetTargetCombined() instead.
func (rc *RecordConfig) GetTargetRFC1035Quoted() string {
return rc.zoneFileQuoted()
}

View file

@ -132,7 +132,7 @@ func handsoff(
if len(conflicts) != 0 {
msgs = append(msgs, fmt.Sprintf("INFO: %d records that are both IGNORE*()'d and not ignored:", len(conflicts)))
for _, r := range conflicts {
msgs = append(msgs, fmt.Sprintf(" %s %s %s", r.GetLabelFQDN(), r.Type, r.GetTargetRFC1035Quoted()))
msgs = append(msgs, fmt.Sprintf(" %s %s %s", r.GetLabelFQDN(), r.Type, r.GetTargetCombined()))
}
if unmanagedSafely {
return nil, nil, fmt.Errorf(strings.Join(msgs, "\n") +
@ -157,7 +157,7 @@ func reportSkips(recs models.Records, full bool) []string {
}
for _, r := range recs[:last] {
msgs = append(msgs, fmt.Sprintf(" %s. %s %s", r.GetLabelFQDN(), r.Type, r.GetTargetRFC1035Quoted()))
msgs = append(msgs, fmt.Sprintf(" %s. %s %s", r.GetLabelFQDN(), r.Type, r.GetTargetCombined()))
}
if shorten {
msgs = append(msgs, fmt.Sprintf(" ...and %d more... (use --full to show all)", len(recs)-maxReport))

View file

@ -36,7 +36,7 @@ func showRecs(recs models.Records) string {
for _, rec := range recs {
result += (rec.GetLabel() +
" " + rec.Type +
" " + rec.GetTargetRFC1035Quoted() +
" " + rec.GetTargetCombined() +
"\n")
}
return result