mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
BIND: reset zonefile for reading records (#2407)
This commit is contained in:
committed by
GitHub
parent
e6f3fb42f2
commit
23ba49e753
@ -158,13 +158,19 @@ func (c *bindProvider) GetZoneRecords(domain string, meta map[string]string) (mo
|
|||||||
if _, err := os.Stat(c.directory); os.IsNotExist(err) {
|
if _, err := os.Stat(c.directory); os.IsNotExist(err) {
|
||||||
printer.Printf("\nWARNING: BIND directory %q does not exist! (will create)\n", c.directory)
|
printer.Printf("\nWARNING: BIND directory %q does not exist! (will create)\n", c.directory)
|
||||||
}
|
}
|
||||||
|
_, okTag := meta[models.DomainTag]
|
||||||
if c.zonefile == "" {
|
_, okUnique := meta[models.DomainUniqueName]
|
||||||
|
if !okTag && !okUnique {
|
||||||
// This layering violation is needed for tests only.
|
// This layering violation is needed for tests only.
|
||||||
// Otherwise, this is set already.
|
// Otherwise, this is set already.
|
||||||
// Note: In this situation there is no "uniquename" or "tag".
|
// Note: In this situation there is no "uniquename" or "tag".
|
||||||
c.zonefile = filepath.Join(c.directory,
|
c.zonefile = filepath.Join(c.directory,
|
||||||
makeFileName(c.filenameformat, domain, domain, ""))
|
makeFileName(c.filenameformat, domain, domain, ""))
|
||||||
|
} else {
|
||||||
|
c.zonefile = filepath.Join(c.directory,
|
||||||
|
makeFileName(c.filenameformat,
|
||||||
|
meta[models.DomainUniqueName], domain, meta[models.DomainTag]),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
content, err := os.ReadFile(c.zonefile)
|
content, err := os.ReadFile(c.zonefile)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
|
Reference in New Issue
Block a user