ionos: fix DNS record removal (#2083)

This commit is contained in:
Ludovic Fernandez 2024-01-17 22:18:17 +01:00 committed by GitHub
parent c847ac4a4c
commit c17f659c5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,6 +6,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"net/http" "net/http"
"strconv"
"strings" "strings"
"time" "time"
@ -171,8 +172,8 @@ func (d *DNSProvider) CleanUp(domain, _, keyAuth string) error {
} }
for _, record := range records { for _, record := range records {
if record.Name == dns01.UnFqdn(info.EffectiveFQDN) && record.Content == info.Value { if record.Name == dns01.UnFqdn(info.EffectiveFQDN) && record.Content == strconv.Quote(info.Value) {
err := d.client.RemoveRecord(ctx, zone.ID, record.ID) err = d.client.RemoveRecord(ctx, zone.ID, record.ID)
if err != nil { if err != nil {
return fmt.Errorf("ionos: failed to remove record (zone=%s, record=%s): %w", zone.ID, record.ID, err) return fmt.Errorf("ionos: failed to remove record (zone=%s, record=%s): %w", zone.ID, record.ID, err)
} }
@ -180,7 +181,7 @@ func (d *DNSProvider) CleanUp(domain, _, keyAuth string) error {
} }
} }
return nil return fmt.Errorf("ionos: failed to remove record, record not found (zone=%s, domain=%s, fqdn=%s, value=%s)", zone.ID, domain, info.EffectiveFQDN, info.Value)
} }
func findZone(zones []internal.Zone, domain string) *internal.Zone { func findZone(zones []internal.Zone, domain string) *internal.Zone {