mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Ban NO_PURGE when using BIND and others. (#180)
This commit is contained in:
committed by
Craig Peterson
parent
73962470bc
commit
2534c8eaf2
@@ -249,6 +249,11 @@ func NormalizeAndValidateConfig(config *models.DNSConfig) (errs []error) {
|
|||||||
} else {
|
} else {
|
||||||
pTypes = append(pTypes, pType)
|
pTypes = append(pTypes, pType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//If NO_PURGE is in use, make sure this *isn't* a provider that *doesn't* support NO_PURGE.
|
||||||
|
if domain.KeepUnknown && providers.ProviderHasCabability(pType, providers.CantUseNOPURGE) {
|
||||||
|
errs = append(errs, fmt.Errorf("%s uses NO_PURGE which is not supported by %s(%s)", domain.Name, p, pType))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalize Nameservers.
|
// Normalize Nameservers.
|
||||||
|
@@ -47,7 +47,7 @@ func initBind(config map[string]string, providermeta json.RawMessage) (providers
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
providers.RegisterDomainServiceProviderType("BIND", initBind, providers.CanUsePTR, providers.CanUseSRV, providers.CanUseCAA)
|
providers.RegisterDomainServiceProviderType("BIND", initBind, providers.CanUsePTR, providers.CanUseSRV, providers.CanUseCAA, providers.CantUseNOPURGE)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SoaInfo struct {
|
type SoaInfo struct {
|
||||||
|
@@ -18,6 +18,8 @@ type Namecheap struct {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
providers.RegisterRegistrarType("NAMECHEAP", newReg)
|
providers.RegisterRegistrarType("NAMECHEAP", newReg)
|
||||||
|
// NOTE(tlim): If in the future the DNS Service Provider is implemented,
|
||||||
|
// most likely it will require providers.CantUseNOPURGE.
|
||||||
}
|
}
|
||||||
|
|
||||||
func newReg(m map[string]string) (providers.Registrar, error) {
|
func newReg(m map[string]string) (providers.Registrar, error) {
|
||||||
|
@@ -49,6 +49,11 @@ const (
|
|||||||
CanUseSRV
|
CanUseSRV
|
||||||
// CanUseCAA indicates the provider can handle CAA records
|
// CanUseCAA indicates the provider can handle CAA records
|
||||||
CanUseCAA
|
CanUseCAA
|
||||||
|
// CantUseNOPURGE indicates NO_PURGE is broken for this provider. To make it
|
||||||
|
// work would require complex emulation of an incremental update mechanism,
|
||||||
|
// so it is easier to simply mark this feature as not working for this
|
||||||
|
// provider.
|
||||||
|
CantUseNOPURGE
|
||||||
)
|
)
|
||||||
|
|
||||||
func ProviderHasCabability(pType string, cap Capability) bool {
|
func ProviderHasCabability(pType string, cap Capability) bool {
|
||||||
|
Reference in New Issue
Block a user