mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-09-10 15:14:25 +08:00
GANDI_V5: BUGFIX: Uppercase labels fail to update (#3582)
This commit is contained in:
parent
6e96b76902
commit
cdbd54016f
1 changed files with 14 additions and 3 deletions
|
@ -254,14 +254,25 @@ func (client *gandiv5Provider) GetZoneRecordsCorrections(dc *models.DomainConfig
|
|||
case diff2.CHANGE:
|
||||
msgs := strings.Join(inst.Msgs, "\n")
|
||||
domain := dc.Name
|
||||
label := inst.Key.NameFQDN
|
||||
shortname := dnsutil.TrimDomainName(label, dc.Name)
|
||||
// DNSControl attempts to lowercase all labels (See Opinion #4 in
|
||||
// https://docs.dnscontrol.org/developer-info/opinions).
|
||||
|
||||
// Sadly, the Gandi API has a bug (I consider it a bug) that to update the
|
||||
// records at a particular label, the request must specify the label with the
|
||||
// same case as what is stored at Gandi. In other words, the update API does
|
||||
// not use a case-insensitive comparison when looking up the label being
|
||||
// updated.
|
||||
|
||||
// Luckily we save the record as it came from the API in
|
||||
// `.Original`. We can use that to gurantee we specify the label
|
||||
// with the case that Gandi is expecting.
|
||||
originalRrsetName := inst.Old[0].Original.(livedns.DomainRecord).RrsetName
|
||||
ns := recordsToNative(inst.New, dc.Name)
|
||||
corrections = append(corrections,
|
||||
&models.Correction{
|
||||
Msg: msgs,
|
||||
F: func() error {
|
||||
res, err := g.UpdateDomainRecordsByName(domain, shortname, ns)
|
||||
res, err := g.UpdateDomainRecordsByName(domain, originalRrsetName, ns)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%+v ret=%03d: %w", res, res.Code, err)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue