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

ROUTE53: fix R53_ZONE() handling for domains (#2306)

Co-authored-by: Tom Limoncelli <tal@whatexit.org>
This commit is contained in:
Tom Limoncelli
2023-05-02 13:04:59 -04:00
committed by GitHub
parent 49e9279388
commit 489be2e3dc
52 changed files with 151 additions and 89 deletions

View File

@@ -153,7 +153,7 @@ func (c *bindProvider) ListZones() ([]string, error) {
}
// GetZoneRecords gets the records of a zone and returns them in RecordConfig format.
func (c *bindProvider) GetZoneRecords(domain string) (models.Records, error) {
func (c *bindProvider) GetZoneRecords(domain string, meta map[string]string) (models.Records, error) {
if _, err := os.Stat(c.directory); os.IsNotExist(err) {
printer.Printf("\nWARNING: BIND directory %q does not exist!\n", c.directory)
@@ -162,6 +162,7 @@ func (c *bindProvider) GetZoneRecords(domain string) (models.Records, error) {
if c.zonefile == "" {
// This layering violation is needed for tests only.
// Otherwise, this is set already.
// Note: In this situation there is no "uniquename" or "tag".
c.zonefile = filepath.Join(c.directory,
makeFileName(c.filenameformat, domain, domain, ""))
}
@@ -297,7 +298,9 @@ func (c *bindProvider) GetZoneRecordsCorrections(dc *models.DomainConfig, foundR
}
c.zonefile = filepath.Join(c.directory,
makeFileName(c.filenameformat, dc.Name, dc.Name, ""))
makeFileName(c.filenameformat,
dc.Metadata[models.DOMAIN_UNIQUENAME], dc.Name, dc.Metadata[models.DOMAIN_TAG]),
)
// We only change the serial number if there is a change.
if !c.skipNextSoaIncrease {

View File

@@ -11,6 +11,7 @@ import (
// makeFileName uses format to generate a zone's filename. See the
func makeFileName(format, uniquename, domain, tag string) string {
//fmt.Printf("DEBUG: makeFileName(%q, %q, %q, %q)\n", format, uniquename, domain, tag)
if format == "" {
fmt.Fprintf(os.Stderr, "BUG: makeFileName called with null format\n")
return uniquename
@@ -55,6 +56,7 @@ func makeFileName(format, uniquename, domain, tag string) string {
}
}
//fmt.Printf("DEBUG: makeFileName returns= %q\n", b.String())
return b.String()
}