dns providers: fix errors. (#642)
* fix: gloud errors. * fix: azure errors. * fix: iij errors.
This commit is contained in:
parent
039f5cf785
commit
ab0048544f
3 changed files with 20 additions and 5 deletions
|
@ -127,8 +127,11 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = rsc.CreateOrUpdate(ctx, d.config.ResourceGroup, zone, relative, dns.TXT, rec, "", "")
|
_, err = rsc.CreateOrUpdate(ctx, d.config.ResourceGroup, zone, relative, dns.TXT, rec, "", "")
|
||||||
|
if err != nil {
|
||||||
return fmt.Errorf("azure: %v", err)
|
return fmt.Errorf("azure: %v", err)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// CleanUp removes the TXT record matching the specified parameters
|
// CleanUp removes the TXT record matching the specified parameters
|
||||||
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
||||||
|
@ -150,8 +153,11 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
||||||
rsc.Authorizer = autorest.NewBearerAuthorizer(spt)
|
rsc.Authorizer = autorest.NewBearerAuthorizer(spt)
|
||||||
|
|
||||||
_, err = rsc.Delete(ctx, d.config.ResourceGroup, zone, relative, dns.TXT, "")
|
_, err = rsc.Delete(ctx, d.config.ResourceGroup, zone, relative, dns.TXT, "")
|
||||||
|
if err != nil {
|
||||||
return fmt.Errorf("azure: %v", err)
|
return fmt.Errorf("azure: %v", err)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Checks that azure has a zone for this domain name.
|
// Checks that azure has a zone for this domain name.
|
||||||
func (d *DNSProvider) getHostedZoneID(ctx context.Context, fqdn string) (string, error) {
|
func (d *DNSProvider) getHostedZoneID(ctx context.Context, fqdn string) (string, error) {
|
||||||
|
|
|
@ -188,8 +188,11 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = d.client.Changes.Create(d.config.Project, zone, &dns.Change{Deletions: records}).Do()
|
_, err = d.client.Changes.Create(d.config.Project, zone, &dns.Change{Deletions: records}).Do()
|
||||||
|
if err != nil {
|
||||||
return fmt.Errorf("googlecloud: %v", err)
|
return fmt.Errorf("googlecloud: %v", err)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Timeout customizes the timeout values used by the ACME package for checking
|
// Timeout customizes the timeout values used by the ACME package for checking
|
||||||
// DNS record validity.
|
// DNS record validity.
|
||||||
|
|
|
@ -76,16 +76,22 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
||||||
_, value, _ := acme.DNS01Record(domain, keyAuth)
|
_, value, _ := acme.DNS01Record(domain, keyAuth)
|
||||||
|
|
||||||
err := d.addTxtRecord(domain, value)
|
err := d.addTxtRecord(domain, value)
|
||||||
|
if err != nil {
|
||||||
return fmt.Errorf("iij: %v", err)
|
return fmt.Errorf("iij: %v", err)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// CleanUp removes the TXT record matching the specified parameters
|
// CleanUp removes the TXT record matching the specified parameters
|
||||||
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
||||||
_, value, _ := acme.DNS01Record(domain, keyAuth)
|
_, value, _ := acme.DNS01Record(domain, keyAuth)
|
||||||
|
|
||||||
err := d.deleteTxtRecord(domain, value)
|
err := d.deleteTxtRecord(domain, value)
|
||||||
|
if err != nil {
|
||||||
return fmt.Errorf("iij: %v", err)
|
return fmt.Errorf("iij: %v", err)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (d *DNSProvider) addTxtRecord(domain, value string) error {
|
func (d *DNSProvider) addTxtRecord(domain, value string) error {
|
||||||
zones, err := d.listZones()
|
zones, err := d.listZones()
|
||||||
|
|
Loading…
Reference in a new issue