mirror of
https://github.com/notherealmarco/coredns-deployment.git
synced 2025-05-06 04:42:36 +02:00
Alter existing "deprecated" function to return all migration notices (#159)
This commit is contained in:
parent
5960d7facb
commit
709b136563
7 changed files with 19 additions and 122 deletions
|
@ -12,18 +12,11 @@ import (
|
|||
"github.com/coredns/deployment/kubernetes/migration/corefile"
|
||||
)
|
||||
|
||||
// Deprecated returns a list of deprecated plugins or directives present in the Corefile. Each Notice returned is a
|
||||
// warning, e.g. "plugin 'foo' is deprecated." An empty list returned means there are no deprecated plugins/options
|
||||
// present in the Corefile.
|
||||
// Deprecated returns a list of deprecated, removed, ignored and new default plugins or directives present in the Corefile.
|
||||
// Each Notice returned is a warning, e.g. "plugin 'foo' is deprecated." An empty list returned means there are no
|
||||
// deprecated, removed, ignored or new default plugins/options present in the Corefile.
|
||||
func Deprecated(fromCoreDNSVersion, toCoreDNSVersion, corefileStr string) ([]Notice, error) {
|
||||
return getStatus(fromCoreDNSVersion, toCoreDNSVersion, corefileStr, deprecated)
|
||||
}
|
||||
|
||||
// Removed returns a list of removed plugins or directives present in the Corefile. Each Notice returned is a warning,
|
||||
// e.g. "plugin 'foo' is no longer supported." An empty list returned means there are no removed plugins/options
|
||||
// present in the Corefile.
|
||||
func Removed(fromCoreDNSVersion, toCoreDNSVersion, corefileStr string) ([]Notice, error) {
|
||||
return getStatus(fromCoreDNSVersion, toCoreDNSVersion, corefileStr, removed)
|
||||
return getStatus(fromCoreDNSVersion, toCoreDNSVersion, corefileStr, all)
|
||||
}
|
||||
|
||||
// Unsupported returns a list of plugins that are not recognized/supported by the migration tool (but may still be valid in CoreDNS).
|
||||
|
@ -57,10 +50,10 @@ func getStatus(fromCoreDNSVersion, toCoreDNSVersion, corefileStr, status string)
|
|||
if !present {
|
||||
continue
|
||||
}
|
||||
if vp.status == status {
|
||||
if vp.status != "" {
|
||||
notices = append(notices, Notice{
|
||||
Plugin: p.Name,
|
||||
Severity: status,
|
||||
Severity: vp.status,
|
||||
Version: v,
|
||||
ReplacedBy: vp.replacedBy,
|
||||
Additional: vp.additional,
|
||||
|
@ -86,8 +79,8 @@ func getStatus(fromCoreDNSVersion, toCoreDNSVersion, corefileStr, status string)
|
|||
if !present {
|
||||
continue
|
||||
}
|
||||
if vo.status == status {
|
||||
notices = append(notices, Notice{Plugin: p.Name, Option: o.Name, Severity: status, Version: v})
|
||||
if vo.status != "" {
|
||||
notices = append(notices, Notice{Plugin: p.Name, Option: o.Name, Severity: vo.status, Version: v})
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue