nifcloud: fix bug in case of same auth zone (#2125)

Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
fuku 2024-03-05 04:17:28 +09:00 committed by GitHub
parent 6933296e2f
commit 82e9a5e2a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -131,7 +131,15 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
}
func (d *DNSProvider) changeRecord(action, fqdn, value string, ttl int) error {
authZone, err := dns01.FindZoneByFqdn(fqdn)
if err != nil {
return fmt.Errorf("could not find zone: %w", err)
}
name := dns01.UnFqdn(fqdn)
if authZone == fqdn {
name = "@"
}
reqParams := internal.ChangeResourceRecordSetsRequest{
XMLNs: internal.XMLNs,
@ -159,11 +167,6 @@ func (d *DNSProvider) changeRecord(action, fqdn, value string, ttl int) error {
},
}
authZone, err := dns01.FindZoneByFqdn(fqdn)
if err != nil {
return fmt.Errorf("could not find zone: %w", err)
}
ctx := context.Background()
resp, err := d.client.ChangeResourceRecordSets(ctx, dns01.UnFqdn(authZone), reqParams)