From a6d389ae87cda0a64225b86af8abf6d2caf75083 Mon Sep 17 00:00:00 2001 From: schristoff <28318173+schristoff@users.noreply.github.com> Date: Tue, 4 Jun 2024 12:29:10 -0600 Subject: [PATCH] chore: deprecate DeprecatedKeys Signed-off-by: schristoff <28318173+schristoff@users.noreply.github.com> --- src/internal/packager/template/template.go | 15 ++------------- src/pkg/variables/common.go | 4 +--- src/pkg/variables/templates.go | 6 ------ 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/internal/packager/template/template.go b/src/internal/packager/template/template.go index f823c567f8..20f0d42af4 100644 --- a/src/internal/packager/template/template.go +++ b/src/internal/packager/template/template.go @@ -21,8 +21,7 @@ import ( ) const ( - depMarkerOld = "DATA_INJECTON_MARKER" - depMarkerNew = "DATA_INJECTION_MARKER" + depMarker = "DATA_INJECTION_MARKER" ) // GetZarfVariableConfig gets a variable configuration specific to Zarf @@ -36,7 +35,6 @@ func GetZarfVariableConfig() *variables.VariableConfig { return variables.New( "zarf", - deprecatedKeys(), prompt, slog.New(message.ZarfHandler{})) } @@ -65,9 +63,7 @@ func GetZarfTemplates(componentName string, state *types.ZarfState) (templateMap "GIT_AUTH_PULL": gitInfo.PullPassword, } - // Preserve existing misspelling for backwards compatibility - builtinMap[depMarkerOld] = config.GetDataInjectionMarker() - builtinMap[depMarkerNew] = config.GetDataInjectionMarker() + builtinMap[depMarker] = config.GetDataInjectionMarker() // Don't template component-specific variables for every component switch componentName { @@ -111,13 +107,6 @@ func GetZarfTemplates(componentName string, state *types.ZarfState) (templateMap return templateMap, nil } -// deprecatedKeys returns a map of template keys that are deprecated -func deprecatedKeys() map[string]string { - return map[string]string{ - fmt.Sprintf("###ZARF_%s###", depMarkerOld): fmt.Sprintf("###ZARF_%s###", depMarkerNew), - } -} - // generateHtpasswd returns an htpasswd string for the current state's RegistryInfo. func generateHtpasswd(regInfo *types.RegistryInfo) (string, error) { // Only calculate this for internal registries to allow longer external passwords diff --git a/src/pkg/variables/common.go b/src/pkg/variables/common.go index 6cf73824d1..ae2bb5fac5 100644 --- a/src/pkg/variables/common.go +++ b/src/pkg/variables/common.go @@ -11,7 +11,6 @@ import ( // VariableConfig represents a value to be templated into a text file. type VariableConfig struct { templatePrefix string - deprecatedKeys map[string]string applicationTemplates map[string]*TextTemplate setVariableMap SetVariableMap @@ -22,10 +21,9 @@ type VariableConfig struct { } // New creates a new VariableConfig -func New(templatePrefix string, deprecatedKeys map[string]string, prompt func(variable InteractiveVariable) (value string, err error), logger *slog.Logger) *VariableConfig { +func New(templatePrefix string, prompt func(variable InteractiveVariable) (value string, err error), logger *slog.Logger) *VariableConfig { return &VariableConfig{ templatePrefix: templatePrefix, - deprecatedKeys: deprecatedKeys, applicationTemplates: make(map[string]*TextTemplate), setVariableMap: make(SetVariableMap), prompt: prompt, diff --git a/src/pkg/variables/templates.go b/src/pkg/variables/templates.go index 356345af38..9363357d39 100644 --- a/src/pkg/variables/templates.go +++ b/src/pkg/variables/templates.go @@ -89,12 +89,6 @@ func (vc *VariableConfig) ReplaceTextTemplate(path string) error { preTemplate := matches[regexTemplateLine.SubexpIndex("preTemplate")] templateKey := matches[regexTemplateLine.SubexpIndex("template")] - _, present := vc.deprecatedKeys[templateKey] - if present { - deprecationWarning := fmt.Sprintf("This Zarf Package uses a deprecated variable: '%s' changed to '%s'. Please notify your package creator for an update.", templateKey, vc.deprecatedKeys[templateKey]) - vc.logger.Warn(deprecationWarning) - } - template := templateMap[templateKey] // Check if the template is nil (present), use the original templateKey if not (so that it is not replaced).