namesilo: restrict CleanUp (#2287)
This commit is contained in:
parent
c704ba5832
commit
56986eaa99
1 changed files with 6 additions and 9 deletions
|
@ -100,11 +100,6 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
||||||
return fmt.Errorf("namesilo: %w", err)
|
return fmt.Errorf("namesilo: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = d.CleanUp(domain, token, keyAuth)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = d.client.DnsAddRecord(&namesilo.DnsAddRecordParams{
|
_, err = d.client.DnsAddRecord(&namesilo.DnsAddRecordParams{
|
||||||
Domain: zoneName,
|
Domain: zoneName,
|
||||||
Type: "TXT",
|
Type: "TXT",
|
||||||
|
@ -139,16 +134,18 @@ func (d *DNSProvider) CleanUp(domain, _, keyAuth string) error {
|
||||||
return fmt.Errorf("namesilo: %w", err)
|
return fmt.Errorf("namesilo: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var lastErr error
|
|
||||||
for _, r := range resp.Reply.ResourceRecord {
|
for _, r := range resp.Reply.ResourceRecord {
|
||||||
if r.Type == "TXT" && (r.Host == subdomain || r.Host == dns01.UnFqdn(info.EffectiveFQDN)) {
|
if r.Type == "TXT" && r.Value == info.Value && (r.Host == subdomain || r.Host == dns01.UnFqdn(info.EffectiveFQDN)) {
|
||||||
_, err := d.client.DnsDeleteRecord(&namesilo.DnsDeleteRecordParams{Domain: zoneName, ID: r.RecordID})
|
_, err := d.client.DnsDeleteRecord(&namesilo.DnsDeleteRecordParams{Domain: zoneName, ID: r.RecordID})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
lastErr = fmt.Errorf("namesilo: %w", err)
|
return fmt.Errorf("namesilo: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return lastErr
|
return fmt.Errorf("namesilo: no TXT record to delete for %s (%s)", info.EffectiveFQDN, info.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Timeout returns the timeout and interval to use when checking for DNS propagation.
|
// Timeout returns the timeout and interval to use when checking for DNS propagation.
|
||||||
|
|
Loading…
Reference in a new issue