fix: TXT records clean up for Selectel DNS provider (#797)

This commit is contained in:
Daniil Rutskiy 2019-02-14 15:30:03 +01:00 committed by Ludovic Fernandez
parent 1c6f67f47a
commit 938ba435d6

View file

@ -127,6 +127,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes a TXT record used for DNS-01 challenge. // CleanUp removes a TXT record used for DNS-01 challenge.
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
fqdn, _ := dns01.GetRecord(domain, keyAuth) fqdn, _ := dns01.GetRecord(domain, keyAuth)
recordName := dns01.UnFqdn(fqdn)
domainObj, err := d.client.GetDomainByName(domain) domainObj, err := d.client.GetDomainByName(domain)
if err != nil { if err != nil {
@ -141,7 +142,7 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
// Delete records with specific FQDN // Delete records with specific FQDN
var lastErr error var lastErr error
for _, record := range records { for _, record := range records {
if record.Name == fqdn { if record.Name == recordName {
err = d.client.DeleteRecord(domainObj.ID, record.ID) err = d.client.DeleteRecord(domainObj.ID, record.ID)
if err != nil { if err != nil {
lastErr = fmt.Errorf("selectel: %v", err) lastErr = fmt.Errorf("selectel: %v", err)