mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-09-12 08:04:28 +08:00
INWX: Adopt diff2 in compatibility mode (#1891)
This commit is contained in:
parent
8f8c0abaf3
commit
30c653eeba
1 changed files with 30 additions and 31 deletions
|
@ -242,42 +242,41 @@ func (api *inwxAPI) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Cor
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
differ := diff.New(dc)
|
var corrections []*models.Correction
|
||||||
_, create, del, mod, err := differ.IncrementalDiff(foundRecords)
|
var create, del, mod diff.Changeset
|
||||||
|
if !diff2.EnableDiff2 {
|
||||||
|
differ := diff.New(dc)
|
||||||
|
_, create, del, mod, err = differ.IncrementalDiff(foundRecords)
|
||||||
|
} else {
|
||||||
|
differ := diff.NewCompat(dc)
|
||||||
|
_, create, del, mod, err = differ.IncrementalDiff(foundRecords)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var corrections []*models.Correction
|
for _, d := range create {
|
||||||
if !diff2.EnableDiff2 || true { // Remove "|| true" when diff2 version arrives
|
des := d.Desired
|
||||||
|
corrections = append(corrections, &models.Correction{
|
||||||
for _, d := range create {
|
Msg: d.String(),
|
||||||
des := d.Desired
|
F: func() error { return api.createRecord(dc.Name, des) },
|
||||||
corrections = append(corrections, &models.Correction{
|
})
|
||||||
Msg: d.String(),
|
}
|
||||||
F: func() error { return api.createRecord(dc.Name, des) },
|
for _, d := range del {
|
||||||
})
|
existingID := d.Existing.Original.(goinwx.NameserverRecord).ID
|
||||||
}
|
corrections = append(corrections, &models.Correction{
|
||||||
for _, d := range del {
|
Msg: d.String(),
|
||||||
existingID := d.Existing.Original.(goinwx.NameserverRecord).ID
|
F: func() error { return api.deleteRecord(existingID) },
|
||||||
corrections = append(corrections, &models.Correction{
|
})
|
||||||
Msg: d.String(),
|
}
|
||||||
F: func() error { return api.deleteRecord(existingID) },
|
for _, d := range mod {
|
||||||
})
|
rec := d.Desired
|
||||||
}
|
existingID := d.Existing.Original.(goinwx.NameserverRecord).ID
|
||||||
for _, d := range mod {
|
corrections = append(corrections, &models.Correction{
|
||||||
rec := d.Desired
|
Msg: d.String(),
|
||||||
existingID := d.Existing.Original.(goinwx.NameserverRecord).ID
|
F: func() error { return api.updateRecord(existingID, rec) },
|
||||||
corrections = append(corrections, &models.Correction{
|
})
|
||||||
Msg: d.String(),
|
|
||||||
F: func() error { return api.updateRecord(existingID, rec) },
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return corrections, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert Future diff2 version here.
|
|
||||||
|
|
||||||
return corrections, nil
|
return corrections, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue