ionos: follow CNAME (#2281)
This commit is contained in:
parent
0da0942081
commit
69bd2e0373
1 changed files with 10 additions and 8 deletions
|
@ -113,14 +113,15 @@ func (d *DNSProvider) Present(domain, _, keyAuth string) error {
|
|||
return fmt.Errorf("ionos: failed to get zones: %w", err)
|
||||
}
|
||||
|
||||
// TODO(ldez) replace domain by FQDN to follow CNAME.
|
||||
zone := findZone(zones, domain)
|
||||
name := dns01.UnFqdn(info.EffectiveFQDN)
|
||||
|
||||
zone := findZone(zones, name)
|
||||
if zone == nil {
|
||||
return errors.New("ionos: no matching zone found for domain")
|
||||
}
|
||||
|
||||
filter := &internal.RecordsFilter{
|
||||
Suffix: dns01.UnFqdn(info.EffectiveFQDN),
|
||||
Suffix: name,
|
||||
RecordType: "TXT",
|
||||
}
|
||||
|
||||
|
@ -130,7 +131,7 @@ func (d *DNSProvider) Present(domain, _, keyAuth string) error {
|
|||
}
|
||||
|
||||
records = append(records, internal.Record{
|
||||
Name: dns01.UnFqdn(info.EffectiveFQDN),
|
||||
Name: name,
|
||||
Content: info.Value,
|
||||
TTL: d.config.TTL,
|
||||
Type: "TXT",
|
||||
|
@ -155,14 +156,15 @@ func (d *DNSProvider) CleanUp(domain, _, keyAuth string) error {
|
|||
return fmt.Errorf("ionos: failed to get zones: %w", err)
|
||||
}
|
||||
|
||||
// TODO(ldez) replace domain by FQDN to follow CNAME.
|
||||
zone := findZone(zones, domain)
|
||||
name := dns01.UnFqdn(info.EffectiveFQDN)
|
||||
|
||||
zone := findZone(zones, name)
|
||||
if zone == nil {
|
||||
return errors.New("ionos: no matching zone found for domain")
|
||||
}
|
||||
|
||||
filter := &internal.RecordsFilter{
|
||||
Suffix: dns01.UnFqdn(info.EffectiveFQDN),
|
||||
Suffix: name,
|
||||
RecordType: "TXT",
|
||||
}
|
||||
|
||||
|
@ -172,7 +174,7 @@ func (d *DNSProvider) CleanUp(domain, _, keyAuth string) error {
|
|||
}
|
||||
|
||||
for _, record := range records {
|
||||
if record.Name == dns01.UnFqdn(info.EffectiveFQDN) && record.Content == strconv.Quote(info.Value) {
|
||||
if record.Name == name && record.Content == strconv.Quote(info.Value) {
|
||||
err = d.client.RemoveRecord(ctx, zone.ID, record.ID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("ionos: failed to remove record (zone=%s, record=%s): %w", zone.ID, record.ID, err)
|
||||
|
|
Loading…
Reference in a new issue