mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-09-12 16:14:42 +08:00
NAMECHEAP: Adopt diff2 in compatibility mode (#1894)
This commit is contained in:
parent
572f2ce28c
commit
77df64d497
2 changed files with 39 additions and 41 deletions
|
@ -147,9 +147,9 @@ DNSControl can be installed via packages for macOS, Linux and Windows, or from s
|
||||||
|
|
||||||
See [dnscontrol-action](https://github.com/koenrh/dnscontrol-action) or [gacts/install-dnscontrol](https://github.com/gacts/install-dnscontrol).
|
See [dnscontrol-action](https://github.com/koenrh/dnscontrol-action) or [gacts/install-dnscontrol](https://github.com/gacts/install-dnscontrol).
|
||||||
|
|
||||||
## Deprecation warnings (updated 2022-06-04)
|
## Deprecation warnings (updated 2023-01-18)
|
||||||
|
|
||||||
- **Call for new volunteer maintainers for NAMEDOTCOM, and SOFTLAYER.** These providers have no maintainer. Maintainers respond to PRs and fix bugs in a timely manner, and try to stay on top of protocol changes.
|
- **Call for new volunteer maintainers for NAMECHEAP, NAMEDOTCOM, and SOFTLAYER.** These providers have no maintainer. Maintainers respond to PRs and fix bugs in a timely manner, and try to stay on top of protocol changes.
|
||||||
- **ACME/Let's Encrypt support is frozen and will be removed after December 31, 2022.** The `get-certs` command (renews certs via Let's Encrypt) has no maintainer. There are other projects that do a better job. If you don't use this feature, please do not start. If you do use this feature, please plan on migrating to something else. See discussion in [issues/1400](https://github.com/StackExchange/dnscontrol/issues/1400)
|
- **ACME/Let's Encrypt support is frozen and will be removed after December 31, 2022.** The `get-certs` command (renews certs via Let's Encrypt) has no maintainer. There are other projects that do a better job. If you don't use this feature, please do not start. If you do use this feature, please plan on migrating to something else. See discussion in [issues/1400](https://github.com/StackExchange/dnscontrol/issues/1400)
|
||||||
- **get-zones syntax changes in v3.16** Starting in v3.16, the command line arguments for `dnscontrol get-zones` changes. For backwards compatibility change `provider` to `-`. See documentation for details.
|
- **get-zones syntax changes in v3.16** Starting in v3.16, the command line arguments for `dnscontrol get-zones` changes. For backwards compatibility change `provider` to `-`. See documentation for details.
|
||||||
|
|
||||||
|
|
|
@ -191,48 +191,46 @@ func (n *namecheapProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mo
|
||||||
// Normalize
|
// Normalize
|
||||||
models.PostProcessRecords(actual)
|
models.PostProcessRecords(actual)
|
||||||
|
|
||||||
var corrections []*models.Correction
|
var create, delete, modify diff.Changeset
|
||||||
if !diff2.EnableDiff2 || true { // Remove "|| true" when diff2 version arrives
|
if !diff2.EnableDiff2 {
|
||||||
|
|
||||||
differ := diff.New(dc)
|
differ := diff.New(dc)
|
||||||
_, create, delete, modify, err := differ.IncrementalDiff(actual)
|
_, create, delete, modify, err = differ.IncrementalDiff(actual)
|
||||||
if err != nil {
|
} else {
|
||||||
return nil, err
|
differ := diff.NewCompat(dc)
|
||||||
}
|
_, create, delete, modify, err = differ.IncrementalDiff(actual)
|
||||||
|
}
|
||||||
// // because namecheap doesn't have selective create, delete, modify,
|
if err != nil {
|
||||||
// // we bundle them all up to send at once. We *do* want to see the
|
return nil, err
|
||||||
// // changes though
|
|
||||||
|
|
||||||
var desc []string
|
|
||||||
for _, i := range create {
|
|
||||||
desc = append(desc, "\n"+i.String())
|
|
||||||
}
|
|
||||||
for _, i := range delete {
|
|
||||||
desc = append(desc, "\n"+i.String())
|
|
||||||
}
|
|
||||||
for _, i := range modify {
|
|
||||||
desc = append(desc, "\n"+i.String())
|
|
||||||
}
|
|
||||||
|
|
||||||
msg := fmt.Sprintf("GENERATE_ZONE: %s (%d records)%s", dc.Name, len(dc.Records), desc)
|
|
||||||
corrections := []*models.Correction{}
|
|
||||||
|
|
||||||
// only create corrections if there are changes
|
|
||||||
if len(desc) > 0 {
|
|
||||||
corrections = append(corrections,
|
|
||||||
&models.Correction{
|
|
||||||
Msg: msg,
|
|
||||||
F: func() error {
|
|
||||||
return n.generateRecords(dc)
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return corrections, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert Future diff2 version here.
|
// // because namecheap doesn't have selective create, delete, modify,
|
||||||
|
// // we bundle them all up to send at once. We *do* want to see the
|
||||||
|
// // changes though
|
||||||
|
|
||||||
|
var desc []string
|
||||||
|
for _, i := range create {
|
||||||
|
desc = append(desc, "\n"+i.String())
|
||||||
|
}
|
||||||
|
for _, i := range delete {
|
||||||
|
desc = append(desc, "\n"+i.String())
|
||||||
|
}
|
||||||
|
for _, i := range modify {
|
||||||
|
desc = append(desc, "\n"+i.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
msg := fmt.Sprintf("GENERATE_ZONE: %s (%d records)%s", dc.Name, len(dc.Records), desc)
|
||||||
|
var corrections []*models.Correction
|
||||||
|
|
||||||
|
// only create corrections if there are changes
|
||||||
|
if len(desc) > 0 {
|
||||||
|
corrections = append(corrections,
|
||||||
|
&models.Correction{
|
||||||
|
Msg: msg,
|
||||||
|
F: func() error {
|
||||||
|
return n.generateRecords(dc)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return corrections, nil
|
return corrections, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue