k8s migration: include add notifications in deprecation result (#165)

* fix

* ensure newdefaults already present in corefile are not reported
This commit is contained in:
Chris O'Haver 2019-05-14 09:59:18 -04:00 committed by GitHub
parent d7f87ddf2a
commit 910ada176e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 7 deletions

View file

@ -50,7 +50,7 @@ func getStatus(fromCoreDNSVersion, toCoreDNSVersion, corefileStr, status string)
if !present {
continue
}
if vp.status != "" {
if vp.status != "" && vp.status != newdefault {
notices = append(notices, Notice{
Plugin: p.Name,
Severity: vp.status,
@ -79,11 +79,39 @@ func getStatus(fromCoreDNSVersion, toCoreDNSVersion, corefileStr, status string)
if !present {
continue
}
if vo.status != "" {
if vo.status != "" && vo.status != newdefault {
notices = append(notices, Notice{Plugin: p.Name, Option: o.Name, Severity: vo.status, Version: v})
continue
}
}
if status != unsupported {
CheckForNewOptions:
for name, vo := range Versions[v].plugins[p.Name].options {
if vo.status != newdefault {
continue
}
for _, o := range p.Options {
if name == o.Name {
continue CheckForNewOptions
}
}
notices = append(notices, Notice{Plugin: p.Name, Option: name, Severity: newdefault, Version: v})
}
}
}
if status != unsupported {
CheckForNewPlugins:
for name, vp := range Versions[v].plugins {
if vp.status != newdefault {
continue
}
for _, p := range s.Plugins {
if name == p.Name {
continue CheckForNewPlugins
}
}
notices = append(notices, Notice{Plugin: name, Option: "", Severity: newdefault, Version: v})
}
}
}
if v == toCoreDNSVersion {
@ -94,7 +122,6 @@ func getStatus(fromCoreDNSVersion, toCoreDNSVersion, corefileStr, status string)
}
// Migrate returns version of the Corefile migrated to toCoreDNSVersion, or an error if it cannot.
// TODO: add newdefault bool parameter?
func Migrate(fromCoreDNSVersion, toCoreDNSVersion, corefileStr string, deprecations bool) (string, error) {
err := validateVersions(fromCoreDNSVersion, toCoreDNSVersion)
if err != nil {