diff --git a/commands/ppreviewPush.go b/commands/ppreviewPush.go index b71dfe529..e8a16dca9 100644 --- a/commands/ppreviewPush.go +++ b/commands/ppreviewPush.go @@ -581,7 +581,7 @@ func generatePopulateCorrections(provider *models.DNSProviderInstance, zoneName } return []*models.Correction{{ - Msg: fmt.Sprintf("Create zone '%s' in the '%s' profile", aceZoneName, provider.Name), + Msg: fmt.Sprintf("Ensuring zone %q exists in %q", aceZoneName, provider.Name), F: func() error { return creator.EnsureZoneExists(aceZoneName) }, }} } @@ -604,7 +604,10 @@ func generateDelegationCorrections(zone *models.DomainConfig, providers []*model nameservers.AddNSRecords(zone) if len(zone.Nameservers) == 0 && zone.Metadata["no_ns"] != "true" { - return []*models.Correction{{Msg: fmt.Sprintf("No nameservers declared for domain %q; skipping registrar. Add {no_ns:'true'} to force", zone.Name)}}, 0 + return []*models.Correction{{Msg: fmt.Sprintf("Skipping registrar %q: No nameservers declared for domain %q. Add {no_ns:'true'} to force", + zone.RegistrarName, + zone.Name, + )}}, 0 } corrections, err := zone.RegistrarInstance.Driver.GetRegistrarCorrections(zone) diff --git a/documentation/providers.md b/documentation/providers.md index cdae731e9..d0d52d920 100644 --- a/documentation/providers.md +++ b/documentation/providers.md @@ -19,7 +19,7 @@ If a feature is definitively not supported for whatever reason, we would also li | [`AXFRDDNS`](provider/axfrddns.md) | ❌ | ✅ | ❌ | ❌ | ❔ | ✅ | ✅ | ✅ | ❔ | ✅ | ✅ | ❔ | ✅ | ✅ | ✅ | ✅ | ❔ | ✅ | ❔ | ❔ | ❌ | ❌ | ❌ | | [`AZURE_DNS`](provider/azure_dns.md) | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ | ❔ | ❔ | ❌ | ❌ | ✅ | ❔ | ✅ | ❌ | ❔ | ❌ | ❔ | ❔ | ❔ | ❔ | ✅ | ✅ | ✅ | | [`AZURE_PRIVATE_DNS`](provider/azure_private_dns.md) | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❔ | ❔ | ❌ | ❌ | ✅ | ❔ | ✅ | ❌ | ❔ | ❌ | ❔ | ❔ | ❔ | ❔ | ✅ | ✅ | ✅ | -| [`BIND`](provider/bind.md) | ✅ | ✅ | ❌ | ❌ | ❔ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| [`BIND`](provider/bind.md) | ✅ | ✅ | ❌ | ✅ | ❔ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | [`BUNNY_DNS`](provider/bunny_dns.md) | ❌ | ✅ | ❌ | ❌ | ✅ | ✅ | ❌ | ❔ | ❌ | ❌ | ✅ | ❌ | ✅ | ❌ | ❔ | ❌ | ❌ | ❌ | ❔ | ❔ | ❌ | ✅ | ✅ | | [`CLOUDFLAREAPI`](provider/cloudflareapi.md) | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ❔ | ✅ | ❌ | ✅ | ✅ | ❔ | ✅ | ✅ | ✅ | ✅ | ❔ | ❔ | ❔ | ❌ | ❌ | ✅ | ✅ | | [`CLOUDNS`](provider/cloudns.md) | ❌ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ❔ | ✅ | ❔ | ✅ | ❔ | ✅ | ✅ | ❔ | ✅ | ❔ | ❔ | ✅ | ❔ | ❔ | ✅ | ✅ | diff --git a/providers/bind/bindProvider.go b/providers/bind/bindProvider.go index 583693141..68b83b426 100644 --- a/providers/bind/bindProvider.go +++ b/providers/bind/bindProvider.go @@ -35,7 +35,7 @@ var features = providers.DocumentationNotes{ // See providers/capabilities.go for the entire list of capabilities. providers.CanAutoDNSSEC: providers.Can("Just writes out a comment indicating DNSSEC was requested"), providers.CanGetZones: providers.Can(), - providers.CanConcur: providers.Cannot(), + providers.CanConcur: providers.Can(), providers.CanUseCAA: providers.Can(), providers.CanUseDHCID: providers.Can(), providers.CanUseDNAME: providers.Can(), @@ -126,8 +126,6 @@ type bindProvider struct { nameservers []*models.Nameserver directory string filenameformat string - zonefile string // Where the zone data is e texpected - zoneFileFound bool // Did the zonefile exist? } // GetNameservers returns the nameservers for a domain. @@ -162,6 +160,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, meta map[string]string) (models.Records, error) { + var zonefile string if _, err := os.Stat(c.directory); os.IsNotExist(err) { printer.Printf("\nWARNING: BIND directory %q does not exist! (will create)\n", c.directory) @@ -172,29 +171,25 @@ func (c *bindProvider) GetZoneRecords(domain string, meta map[string]string) (mo // 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, + zonefile = filepath.Join(c.directory, makeFileName(c.filenameformat, domain, domain, "")) } else { - c.zonefile = filepath.Join(c.directory, + 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(zonefile) if os.IsNotExist(err) { // If the file doesn't exist, that's not an error. Just informational. - c.zoneFileFound = false - fmt.Fprintf(os.Stderr, "File does not yet exist: %q (will create)\n", c.zonefile) + fmt.Fprintf(os.Stderr, "File does not yet exist: %q (will create)\n", zonefile) return nil, nil } if err != nil { - return nil, fmt.Errorf("can't open %s: %w", c.zonefile, err) + return nil, fmt.Errorf("can't open %s: %w", zonefile, err) } - c.zoneFileFound = true - zonefileName := c.zonefile - - return ParseZoneContents(string(content), domain, zonefileName) + return ParseZoneContents(string(content), domain, zonefile) } // ParseZoneContents parses a string as a BIND zone and returns the records. @@ -216,9 +211,14 @@ func ParseZoneContents(content string, zoneName string, zonefileName string) (mo return foundRecords, nil } +func (n *bindProvider) EnsureZoneExists(_ string) error { + return nil +} + // GetZoneRecordsCorrections returns a list of corrections that will turn existing records into dc.Records. func (c *bindProvider) GetZoneRecordsCorrections(dc *models.DomainConfig, foundRecords models.Records) ([]*models.Correction, int, error) { var corrections []*models.Correction + var zonefile string changes := false var msg string @@ -270,7 +270,7 @@ func (c *bindProvider) GetZoneRecordsCorrections(dc *models.DomainConfig, foundR comments = append(comments, "Automatic DNSSEC signing requested") } - c.zonefile = filepath.Join(c.directory, + zonefile = filepath.Join(c.directory, makeFileName(c.filenameformat, dc.Metadata[models.DomainUniqueName], dc.Name, dc.Metadata[models.DomainTag]), ) @@ -287,8 +287,8 @@ func (c *bindProvider) GetZoneRecordsCorrections(dc *models.DomainConfig, foundR &models.Correction{ Msg: msg, F: func() error { - printer.Printf("WRITING ZONEFILE: %v\n", c.zonefile) - fname, err := preprocessFilename(c.zonefile) + printer.Printf("WRITING ZONEFILE: %v\n", zonefile) + fname, err := preprocessFilename(zonefile) if err != nil { return fmt.Errorf("could not create zonefile: %w", err) }