From 73de17adc294e0786ef64d8568a90c5ab2472645 Mon Sep 17 00:00:00 2001 From: Tom Limoncelli Date: Sun, 27 Mar 2022 15:56:57 -0400 Subject: [PATCH] Revert "_PROVIDER flag phase 1: generate warnings" This reverts commit 26c632e05f041e3e4f25872b8c9b1b1b9ba9dfa8. --- build/generate/featureMatrix.go | 3 ++- commands/previewPush.go | 5 ----- docs/_includes/providerfield.html | 6 ------ docs/_providers/activedir.md | 3 --- docs/_providers/akamaiedgedns.md | 1 - docs/_providers/autodns.md | 1 - docs/_providers/axfrddns.md | 1 - docs/_providers/azuredns.md | 2 -- docs/_providers/bind.md | 1 - docs/_providers/cloudflare.md | 1 - docs/_providers/cloudns.md | 1 - docs/_providers/cscglobal.md | 1 - docs/_providers/desec.md | 1 - docs/creds-json.md | 6 +----- providers/config/providerConfig.go | 15 --------------- 15 files changed, 3 insertions(+), 45 deletions(-) delete mode 100644 docs/_includes/providerfield.html diff --git a/build/generate/featureMatrix.go b/build/generate/featureMatrix.go index c27926095..3d8804aea 100644 --- a/build/generate/featureMatrix.go +++ b/build/generate/featureMatrix.go @@ -137,7 +137,8 @@ type FeatureMatrix struct { var tmpl = template.Must(template.New("").Funcs(template.FuncMap{ "safe": func(s string) template.HTML { return template.HTML(s) }, -}).Parse(`{% comment %} +}).Parse(` + {% comment %} Matrix generated by build/generate/featureMatrix.go. DO NOT HAND EDIT! {% endcomment %}{{$providers := .Providers}} diff --git a/commands/previewPush.go b/commands/previewPush.go index a5bfc4608..5ba7b09f6 100644 --- a/commands/previewPush.go +++ b/commands/previewPush.go @@ -203,11 +203,6 @@ func InitializeProviders(credsFile string, cfg *models.DNSConfig, notifyFlag boo isNonDefault[name] = true } } - - // Collect the names of all providers. - // Run through the providerConfigs and output a warning if any are - // invalid. - registrars := map[string]providers.Registrar{} dnsProviders := map[string]providers.DNSServiceProvider{} for _, d := range cfg.Domains { diff --git a/docs/_includes/providerfield.html b/docs/_includes/providerfield.html deleted file mode 100644 index 9f562f9ce..000000000 --- a/docs/_includes/providerfield.html +++ /dev/null @@ -1,6 +0,0 @@ - -NOTE: The `_PROVIDER` field is ignored by the provider. It is used by -DNSControl to cross-check that this entry is used with the proper -provider code. DNSControl produces warnings if it is missing or -invalid. In the future these warnings will become hard errors. - diff --git a/docs/_providers/activedir.md b/docs/_providers/activedir.md index 8876478fd..172801bc0 100644 --- a/docs/_providers/activedir.md +++ b/docs/_providers/activedir.md @@ -30,7 +30,6 @@ The `ActiveDirectory_PS` provider reads an `ADServer` setting from `creds.json` ```js { "activedir": { - "_PROVIDER": "ACTIVEDIRECTORY_PS", "ADServer": "ny-dc01" } } @@ -42,7 +41,6 @@ If you want to modify the "fake powershell" mode details, you can set them in th ```js { "activedir": { - "_PROVIDER": "ACTIVEDIRECTORY_PS", "ADServer": "ny-dc01", "fakeps": "true", "pslog": "powershell.log", @@ -51,7 +49,6 @@ If you want to modify the "fake powershell" mode details, you can set them in th } ``` -{% include providerfield.html %} An example DNS configuration: diff --git a/docs/_providers/akamaiedgedns.md b/docs/_providers/akamaiedgedns.md index 0d1e7cf8b..aa6464808 100644 --- a/docs/_providers/akamaiedgedns.md +++ b/docs/_providers/akamaiedgedns.md @@ -28,7 +28,6 @@ In the credentials file (creds.json), you must provide the following: ```json "akamaiedgedns": { - "_PROVIDER": "AKAMAIEDGEDNS", "client_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "host": "akaa-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxx.akamaiapis.net", "access_token": "akaa-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", diff --git a/docs/_providers/autodns.md b/docs/_providers/autodns.md index 59ea0bc45..da7de8946 100644 --- a/docs/_providers/autodns.md +++ b/docs/_providers/autodns.md @@ -14,7 +14,6 @@ In your credentials file, you must provide [username, password and a context](ht {% highlight json %} { "autodns": { - "_PROVIDER": "AUTODNS", "username": "autodns.service-account@example.com", "password": "[***]", "context": "33004" diff --git a/docs/_providers/axfrddns.md b/docs/_providers/axfrddns.md index 6464b2f39..44151c72e 100644 --- a/docs/_providers/axfrddns.md +++ b/docs/_providers/axfrddns.md @@ -42,7 +42,6 @@ For instance, your `creds.json` might looks like: ```json { "axfrddns": { - "_PROVIDER": "AXFRDDNS", "transfer-key": "hmac-sha256:transfer-key-id:Base64EncodedSecret=", "update-key": "hmac-sha256:update-key-id:AnotherSecret=" } diff --git a/docs/_providers/azuredns.md b/docs/_providers/azuredns.md index 3db97608b..6953e73d5 100644 --- a/docs/_providers/azuredns.md +++ b/docs/_providers/azuredns.md @@ -11,7 +11,6 @@ You can specify the API credentials in the credentials json file: ```json { "azuredns_main":{ - "_PROVIDER": "AZURE_DNS", "SubscriptionID": "AZURE_SUBSCRIPTION_ID", "ResourceGroup": "AZURE_RESOURCE_GROUP", "TenantID": "AZURE_TENANT_ID", @@ -34,7 +33,6 @@ export AZURE_CLIENT_SECRET=BBBBBBBBB ```json { "azuredns_main":{ - "_PROVIDER": "AZURE_DNS", "SubscriptionID": "$AZURE_SUBSCRIPTION_ID", "ResourceGroup": "$AZURE_RESOURCE_GROUP", "TenantID": "$AZURE_TENANT_ID", diff --git a/docs/_providers/bind.md b/docs/_providers/bind.md index 2be733258..95041438a 100644 --- a/docs/_providers/bind.md +++ b/docs/_providers/bind.md @@ -18,7 +18,6 @@ you can specify a `directory` where the provider will look for and create zone f ```json { "bind": { - "_PROVIDER": "BIND", "directory": "myzones", "filenameformat": "%U.zone" << The default } diff --git a/docs/_providers/cloudflare.md b/docs/_providers/cloudflare.md index ae9cddb80..3b2271f1d 100644 --- a/docs/_providers/cloudflare.md +++ b/docs/_providers/cloudflare.md @@ -25,7 +25,6 @@ This method is enabled by setting the "apitoken" value in `creds.json`: ```json { "cloudflare": { - "_PROVIDER": "CLOUDFLAREAPI", "apitoken": "your-cloudflare-api-token", "accountid": "your-cloudflare-account-id" } diff --git a/docs/_providers/cloudns.md b/docs/_providers/cloudns.md index 88465bbc8..928aabd86 100644 --- a/docs/_providers/cloudns.md +++ b/docs/_providers/cloudns.md @@ -14,7 +14,6 @@ Current version of provider doesn't support `sub-auth-user`. ```json { "cloudns": { - "_PROVIDER": "CLOUDNS", "auth-id": "12345", "sub-auth-id": "12345", "auth-password": "your-password" diff --git a/docs/_providers/cscglobal.md b/docs/_providers/cscglobal.md index 9c108ea2c..362d26385 100644 --- a/docs/_providers/cscglobal.md +++ b/docs/_providers/cscglobal.md @@ -14,7 +14,6 @@ In your `creds.json` file, you must provide your API key and user/client token. ```json { "cscglobal": { - "_PROVIDER": "CSCGLOBAL", "api-key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "user-token": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy", "notification_emails": "test@exmaple.tld,hostmaster@example.tld" diff --git a/docs/_providers/desec.md b/docs/_providers/desec.md index 39ea2ec3d..8528a07c1 100644 --- a/docs/_providers/desec.md +++ b/docs/_providers/desec.md @@ -11,7 +11,6 @@ In your providers credentials file you must provide a deSEC account auth token: ```json { "desec": { - "_PROVIDER": "DESEC", "auth-token": "your-deSEC-auth-token" } } diff --git a/docs/creds-json.md b/docs/creds-json.md index e9b58ef09..bcff1e406 100644 --- a/docs/creds-json.md +++ b/docs/creds-json.md @@ -8,22 +8,19 @@ title: creds.json file format When dnscontrol interacts with a provider, any API keys, credentials, or other configuration parameters required are stored in `creds.json`. The file contains a set of key/value pairs for each configuration. That is, since a provider can be used multiple times with different credentials, the file contains a section for each set of credentials. -Here's a sample `creds.json` file: +Here's a sample file: ```json { "cloudflare_tal": { - "_PROVIDER": "CLOUDFLAREAPI", "apikey": "REDACTED", "apiuser": "REDACTED" }, "inside": { - "_PROVIDER": "BIND", "directory": "inzones", "filenameformat": "db_%T%?_%D" }, "hexonet": { - "_PROVIDER": "HEXONET", "apilogin": "$HEXONET_APILOGIN", "apipassword": "$HEXONET_APIPASSWORD", "debugmode": "$HEXONET_DEBUGMODE", @@ -42,7 +39,6 @@ Here's a sample `creds.json` file: * ...are whatever the provider specifies. * ...can be credentials, secrets, or configuration settings. In the above examples the `inside` setting is configuration parameters for the BIND provider, not credentials. * A missing subkey is not an error. The value is the empty string. - * The subkey `_PROVIDER` indicates which provider plug-in to use. In the future it will be required and dnscontrol will report an error if it is missing or invalid. Currently DNSControl reports warnings. * Values: * ...may include any JSON string value including the empty string. * If a subkey starts with `$`, it is taken as an env variable. In the above example, `$HEXONET_APILOGIN` would be replaced by the value of the environment variable `HEXONET_APILOGIN` or the empty string if no such environment variable exists. diff --git a/providers/config/providerConfig.go b/providers/config/providerConfig.go index 56cedf9ca..a1b2aa7dd 100644 --- a/providers/config/providerConfig.go +++ b/providers/config/providerConfig.go @@ -57,24 +57,9 @@ func LoadProviderConfigs(fname string) (map[string]map[string]string, error) { if err = replaceEnvVars(results); err != nil { return nil, err } - - ckeys := keysWithColons(results) - if len(ckeys) != 0 { - fmt.Printf("WARNING: Cred entries may not contain colons in the future. Please fix: %v\n", quotedList(ckeys)) - } - - pkeys := entriesWithoutProvider(results) - if len(pkeys) != 0 { - fmt.Printf("WARNING: Please add a PROVIDER field to these credential entries: %v\n", quotedList(pkeys)) - } - return results, nil } -func quotedList(l []string) string { - return `"` + strings.Join(l, `", "`) + `"` -} - func isExecutable(filename string) bool { if stat, statErr := os.Stat(filename); statErr == nil { if mode := stat.Mode(); mode&0111 == 0111 {