Skip to content

Commit

Permalink
nifcloud: fix bug in case of same auth zone (#2125)
Browse files Browse the repository at this point in the history
Co-authored-by: Fernandez Ludovic <[email protected]>
  • Loading branch information
fuku2014 and ldez authored Mar 4, 2024
1 parent 6933296 commit 82e9a5e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions providers/dns/nifcloud/nifcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 82e9a5e

Please sign in to comment.