BUG: Correctly spell Cabability (#582)

This commit is contained in:
Tom Limoncelli 2020-01-12 11:24:10 -05:00 committed by GitHub
parent 7df73b187c
commit 2c0361b0d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 16 deletions

View file

@ -58,7 +58,7 @@ func generateFeatureMatrix() error {
fm[name] = notes[cap] fm[name] = notes[cap]
return return
} }
fm.SetSimple(name, true, func() bool { return providers.ProviderHasCabability(p, cap) }) fm.SetSimple(name, true, func() bool { return providers.ProviderHasCapability(p, cap) })
} }
setDoc := func(name string, cap providers.Capability, defaultNo bool) { setDoc := func(name string, cap providers.Capability, defaultNo bool) {
if notes[cap] != nil { if notes[cap] != nil {
@ -89,7 +89,7 @@ func generateFeatureMatrix() error {
if notes[cap] != nil { if notes[cap] != nil {
fm["no_purge"] = notes[cap] fm["no_purge"] = notes[cap]
} else { } else {
fm.SetSimple("no_purge", false, func() bool { return !providers.ProviderHasCabability(p, cap) }) fm.SetSimple("no_purge", false, func() bool { return !providers.ProviderHasCapability(p, cap) })
} }
matrix.Providers[p] = fm matrix.Providers[p] = fm
} }

View file

@ -408,7 +408,7 @@ func makeTests(t *testing.T) []*TestCase {
} }
// PTR // PTR
if !providers.ProviderHasCabability(*providerToRun, providers.CanUsePTR) { if !providers.ProviderHasCapability(*providerToRun, providers.CanUsePTR) {
t.Log("Skipping PTR Tests because provider does not support them") t.Log("Skipping PTR Tests because provider does not support them")
} else { } else {
tests = append(tests, tc("Empty"), tests = append(tests, tc("Empty"),
@ -418,7 +418,7 @@ func makeTests(t *testing.T) []*TestCase {
} }
// ALIAS // ALIAS
if !providers.ProviderHasCabability(*providerToRun, providers.CanUseAlias) { if !providers.ProviderHasCapability(*providerToRun, providers.CanUseAlias) {
t.Log("Skipping ALIAS Tests because provider does not support them") t.Log("Skipping ALIAS Tests because provider does not support them")
} else { } else {
tests = append(tests, tc("Empty"), tests = append(tests, tc("Empty"),
@ -429,7 +429,7 @@ func makeTests(t *testing.T) []*TestCase {
} }
// NAPTR // NAPTR
if !providers.ProviderHasCabability(*providerToRun, providers.CanUseNAPTR) { if !providers.ProviderHasCapability(*providerToRun, providers.CanUseNAPTR) {
t.Log("Skipping NAPTR Tests because provider does not support them") t.Log("Skipping NAPTR Tests because provider does not support them")
} else { } else {
tests = append(tests, tc("Empty"), tests = append(tests, tc("Empty"),
@ -446,7 +446,7 @@ func makeTests(t *testing.T) []*TestCase {
} }
// SRV // SRV
if !providers.ProviderHasCabability(*providerToRun, providers.CanUseSRV) { if !providers.ProviderHasCapability(*providerToRun, providers.CanUseSRV) {
t.Log("Skipping SRV Tests because provider does not support them") t.Log("Skipping SRV Tests because provider does not support them")
} else { } else {
tests = append(tests, tc("Empty"), tests = append(tests, tc("Empty"),
@ -467,7 +467,7 @@ func makeTests(t *testing.T) []*TestCase {
} }
// SSHFP // SSHFP
if !providers.ProviderHasCabability(*providerToRun, providers.CanUseSSHFP) { if !providers.ProviderHasCapability(*providerToRun, providers.CanUseSSHFP) {
t.Log("Skipping SSHFP Tests because provider does not support them") t.Log("Skipping SSHFP Tests because provider does not support them")
} else { } else {
tests = append(tests, tc("Empty"), tests = append(tests, tc("Empty"),
@ -490,7 +490,7 @@ func makeTests(t *testing.T) []*TestCase {
} }
// CAA // CAA
if !providers.ProviderHasCabability(*providerToRun, providers.CanUseCAA) { if !providers.ProviderHasCapability(*providerToRun, providers.CanUseCAA) {
t.Log("Skipping CAA Tests because provider does not support them") t.Log("Skipping CAA Tests because provider does not support them")
} else { } else {
tests = append(tests, tc("Empty"), tests = append(tests, tc("Empty"),
@ -504,7 +504,7 @@ func makeTests(t *testing.T) []*TestCase {
} }
// TLSA // TLSA
if !providers.ProviderHasCabability(*providerToRun, providers.CanUseTLSA) { if !providers.ProviderHasCapability(*providerToRun, providers.CanUseTLSA) {
t.Log("Skipping TLSA Tests because provider does not support them") t.Log("Skipping TLSA Tests because provider does not support them")
} else { } else {
sha256hash := strings.Repeat("0123456789abcdef", 4) sha256hash := strings.Repeat("0123456789abcdef", 4)
@ -563,7 +563,7 @@ func makeTests(t *testing.T) []*TestCase {
) )
// TXTMulti // TXTMulti
if !providers.ProviderHasCabability(*providerToRun, providers.CanUseTXTMulti) { if !providers.ProviderHasCapability(*providerToRun, providers.CanUseTXTMulti) {
t.Log("Skipping TXTMulti Tests because provider does not support them") t.Log("Skipping TXTMulti Tests because provider does not support them")
} else { } else {
tests = append(tests, tests = append(tests,
@ -612,7 +612,7 @@ func makeTests(t *testing.T) []*TestCase {
) )
// R53_ALIAS // R53_ALIAS
if !providers.ProviderHasCabability(*providerToRun, providers.CanUseRoute53Alias) { if !providers.ProviderHasCapability(*providerToRun, providers.CanUseRoute53Alias) {
t.Log("Skipping Route53 ALIAS Tests because provider does not support them") t.Log("Skipping Route53 ALIAS Tests because provider does not support them")
} else { } else {
tests = append(tests, tc("Empty"), tests = append(tests, tc("Empty"),

View file

@ -269,12 +269,12 @@ func NormalizeAndValidateConfig(config *models.DNSConfig) (errs []error) {
for _, provider := range domain.DNSProviderInstances { for _, provider := range domain.DNSProviderInstances {
pType := provider.ProviderType pType := provider.ProviderType
// If NO_PURGE is in use, make sure this *isn't* a provider that *doesn't* support NO_PURGE. // 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) { if domain.KeepUnknown && providers.ProviderHasCapability(pType, providers.CantUseNOPURGE) {
errs = append(errs, errors.Errorf("%s uses NO_PURGE which is not supported by %s(%s)", domain.Name, provider.Name, pType)) errs = append(errs, errors.Errorf("%s uses NO_PURGE which is not supported by %s(%s)", domain.Name, provider.Name, pType))
} }
// Record if any providers do not support TXTMulti: // Record if any providers do not support TXTMulti:
if !providers.ProviderHasCabability(pType, providers.CanUseTXTMulti) { if !providers.ProviderHasCapability(pType, providers.CanUseTXTMulti) {
txtMultiDissenters = append(txtMultiDissenters, provider.Name) txtMultiDissenters = append(txtMultiDissenters, provider.Name)
} }
} }
@ -453,7 +453,7 @@ func checkProviderCapabilities(dc *models.DomainConfig) error {
continue continue
} }
for _, provider := range dc.DNSProviderInstances { for _, provider := range dc.DNSProviderInstances {
if !providers.ProviderHasCabability(provider.ProviderType, ty.cap) { if !providers.ProviderHasCapability(provider.ProviderType, ty.cap) {
return errors.Errorf("Domain %s uses %s records, but DNS provider type %s does not support them", dc.Name, ty.rType, provider.ProviderType) return errors.Errorf("Domain %s uses %s records, but DNS provider type %s does not support them", dc.Name, ty.rType, provider.ProviderType)
} }
} }

View file

@ -53,8 +53,8 @@ const (
var providerCapabilities = map[string]map[Capability]bool{} var providerCapabilities = map[string]map[Capability]bool{}
// ProviderHasCabability returns true if provider has capability. // ProviderHasCapability returns true if provider has capability.
func ProviderHasCabability(pType string, cap Capability) bool { func ProviderHasCapability(pType string, cap Capability) bool {
if providerCapabilities[pType] == nil { if providerCapabilities[pType] == nil {
return false return false
} }