From d31768f61ebf1827e0111f6b26e2b35b53de556e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Valais?= Date: Mon, 5 Jul 2021 16:34:20 +0200 Subject: [PATCH] cloudflare dns01: consistent err prefix "while querying the Clouflare API..." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maƫl Valais Co-authored-by: Richard Wall --- pkg/issuer/acme/dns/cloudflare/cloudflare.go | 8 ++++---- pkg/issuer/acme/dns/cloudflare/cloudflare_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/issuer/acme/dns/cloudflare/cloudflare.go b/pkg/issuer/acme/dns/cloudflare/cloudflare.go index ad2b8b06a..11eaa8497 100644 --- a/pkg/issuer/acme/dns/cloudflare/cloudflare.go +++ b/pkg/issuer/acme/dns/cloudflare/cloudflare.go @@ -62,10 +62,10 @@ func NewDNSProvider(dns01Nameservers []string) (*DNSProvider, error) { // DNSProvider instance configured for cloudflare. func NewDNSProviderCredentials(email, key, token string, dns01Nameservers []string) (*DNSProvider, error) { if (email == "" && key != "") || (key == "" && token == "") { - return nil, fmt.Errorf("no cloudflare credential has been given (can be either an API key or an API token)") + return nil, fmt.Errorf("no Cloudflare credential has been given (can be either an API key or an API token)") } if key != "" && token != "" { - return nil, fmt.Errorf("the Cloudflare API key and API token cannot be both present simultanously") + return nil, fmt.Errorf("the Cloudflare API key and API token cannot be both present simultaneously") } // Cloudflare uses the X-Auth-Key header for its authentication. // However, if the value of the X-Auth-Key header is invalid, the go @@ -287,9 +287,9 @@ func (c *DNSProvider) makeRequest(method, uri string, body io.Reader) (json.RawM errStr += fmt.Sprintf("<- %d: %s", chainErr.Code, chainErr.Message) } } - return nil, fmt.Errorf("error from the Cloudflare API for %s %q \n%s", method, uri, errStr) + return nil, fmt.Errorf("while querying the Cloudflare API for %s %q \n%s", method, uri, errStr) } - return nil, fmt.Errorf("error from the Cloudflare API for %s %q", method, uri) + return nil, fmt.Errorf("while querying the Cloudflare API for %s %q", method, uri) } return r.Result, nil diff --git a/pkg/issuer/acme/dns/cloudflare/cloudflare_test.go b/pkg/issuer/acme/dns/cloudflare/cloudflare_test.go index e3dfb8264..e278e71b6 100644 --- a/pkg/issuer/acme/dns/cloudflare/cloudflare_test.go +++ b/pkg/issuer/acme/dns/cloudflare/cloudflare_test.go @@ -73,7 +73,7 @@ func TestNewDNSProviderKeyAndTokenProvided(t *testing.T) { os.Setenv("CLOUDFLARE_EMAIL", "") os.Setenv("CLOUDFLARE_API_KEY", "") _, err := NewDNSProviderCredentials("123", "123", "123", util.RecursiveNameservers) - assert.EqualError(t, err, "CloudFlare key and token are both present") + assert.EqualError(t, err, "the Cloudflare API key and API token cannot be both present simultaneously") restoreCloudFlareEnv() } @@ -89,7 +89,7 @@ func TestNewDNSProviderMissingCredErr(t *testing.T) { os.Setenv("CLOUDFLARE_EMAIL", "") os.Setenv("CLOUDFLARE_API_KEY", "") _, err := NewDNSProvider(util.RecursiveNameservers) - assert.EqualError(t, err, "CloudFlare credentials missing") + assert.EqualError(t, err, "no Cloudflare credential has been given (can be either an API key or an API token)") restoreCloudFlareEnv() }