From 21b09ffcb84b56a8eeac2873562954bc6de0ae15 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Tue, 3 Dec 2024 19:27:11 +0100 Subject: [PATCH] review --- providers/dns/inwx/inwx.go | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/providers/dns/inwx/inwx.go b/providers/dns/inwx/inwx.go index 477df6a1bf..6ed416a276 100644 --- a/providers/dns/inwx/inwx.go +++ b/providers/dns/inwx/inwx.go @@ -180,17 +180,26 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { return fmt.Errorf("inwx: %w", err) } - var lastErr error + var recordID int for _, record := range response.Records { - if record.Content == challengeInfo.Value { - err = d.client.Nameservers.DeleteRecord(record.ID) - if err != nil { - lastErr = fmt.Errorf("inwx: %w", err) - } + if record.Content != challengeInfo.Value { + continue } + + recordID = record.ID + break } - return lastErr + if recordID == 0 { + return errors.New("inwx: TXT record not found") + } + + err = d.client.Nameservers.DeleteRecord(recordID) + if err != nil { + return fmt.Errorf("inwx: %w", err) + } + + return nil } // Timeout returns the timeout and interval to use when checking for DNS propagation.