From ab0048544f02a9530c8dfa6b9c75e1573fe3cd36 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Thu, 20 Sep 2018 23:18:13 +0200 Subject: [PATCH] dns providers: fix errors. (#642) * fix: gloud errors. * fix: azure errors. * fix: iij errors. --- providers/dns/azure/azure.go | 10 ++++++++-- providers/dns/gcloud/googlecloud.go | 5 ++++- providers/dns/iij/iij.go | 10 ++++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/providers/dns/azure/azure.go b/providers/dns/azure/azure.go index 7f156993..8012aa65 100644 --- a/providers/dns/azure/azure.go +++ b/providers/dns/azure/azure.go @@ -127,7 +127,10 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { } _, err = rsc.CreateOrUpdate(ctx, d.config.ResourceGroup, zone, relative, dns.TXT, rec, "", "") - return fmt.Errorf("azure: %v", err) + if err != nil { + return fmt.Errorf("azure: %v", err) + } + return nil } // CleanUp removes the TXT record matching the specified parameters @@ -150,7 +153,10 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { rsc.Authorizer = autorest.NewBearerAuthorizer(spt) _, err = rsc.Delete(ctx, d.config.ResourceGroup, zone, relative, dns.TXT, "") - return fmt.Errorf("azure: %v", err) + if err != nil { + return fmt.Errorf("azure: %v", err) + } + return nil } // Checks that azure has a zone for this domain name. diff --git a/providers/dns/gcloud/googlecloud.go b/providers/dns/gcloud/googlecloud.go index 36e067a5..dbc35904 100644 --- a/providers/dns/gcloud/googlecloud.go +++ b/providers/dns/gcloud/googlecloud.go @@ -188,7 +188,10 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { } _, err = d.client.Changes.Create(d.config.Project, zone, &dns.Change{Deletions: records}).Do() - return fmt.Errorf("googlecloud: %v", err) + if err != nil { + return fmt.Errorf("googlecloud: %v", err) + } + return nil } // Timeout customizes the timeout values used by the ACME package for checking diff --git a/providers/dns/iij/iij.go b/providers/dns/iij/iij.go index 028e335d..fc09f863 100644 --- a/providers/dns/iij/iij.go +++ b/providers/dns/iij/iij.go @@ -76,7 +76,10 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { _, value, _ := acme.DNS01Record(domain, keyAuth) err := d.addTxtRecord(domain, value) - return fmt.Errorf("iij: %v", err) + if err != nil { + return fmt.Errorf("iij: %v", err) + } + return nil } // CleanUp removes the TXT record matching the specified parameters @@ -84,7 +87,10 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { _, value, _ := acme.DNS01Record(domain, keyAuth) err := d.deleteTxtRecord(domain, value) - return fmt.Errorf("iij: %v", err) + if err != nil { + return fmt.Errorf("iij: %v", err) + } + return nil } func (d *DNSProvider) addTxtRecord(domain, value string) error {