mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-19 02:11:17 +02:00
remove HELMFILE_SKIP_INSECURE_TEMPLATE_FUNCTIONS for v1 (#1434)
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/helmfile/helmfile/pkg/envvar"
|
||||
"github.com/helmfile/helmfile/pkg/helmexec"
|
||||
"github.com/helmfile/helmfile/pkg/maputil"
|
||||
"github.com/helmfile/helmfile/pkg/runtime"
|
||||
"github.com/helmfile/helmfile/pkg/yaml"
|
||||
)
|
||||
|
||||
@@ -35,13 +36,24 @@ func (e DisableInsecureFeaturesError) Error() string {
|
||||
}
|
||||
|
||||
var (
|
||||
disableInsecureFeatures bool
|
||||
disableInsecureFeatures bool
|
||||
|
||||
// TODO: Remove this function once Helmfile v0.x
|
||||
skipInsecureTemplateFunctions bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
disableInsecureFeatures, _ = strconv.ParseBool(os.Getenv(envvar.DisableInsecureFeatures))
|
||||
|
||||
// TODO: Remove this function once Helmfile v0.x
|
||||
skipInsecureTemplateFunctions, _ = strconv.ParseBool(os.Getenv(envvar.SkipInsecureTemplateFunctions))
|
||||
skipInsecureTemplateFunctions = func() bool {
|
||||
if runtime.V1Mode {
|
||||
return false
|
||||
}
|
||||
b, _ := strconv.ParseBool(os.Getenv(envvar.SkipInsecureTemplateFunctions))
|
||||
return b
|
||||
}()
|
||||
}
|
||||
|
||||
func (c *Context) createFuncMap() template.FuncMap {
|
||||
@@ -86,6 +98,9 @@ func (c *Context) createFuncMap() template.FuncMap {
|
||||
funcMap["exec"] = func(string, []any, ...string) (string, error) {
|
||||
return "", DisableInsecureFeaturesErr
|
||||
}
|
||||
funcMap["envExec"] = func(map[string]any, string, []any, ...string) (string, error) {
|
||||
return "", DisableInsecureFeaturesErr
|
||||
}
|
||||
funcMap["readFile"] = func(string) (string, error) {
|
||||
return "", DisableInsecureFeaturesErr
|
||||
}
|
||||
|
||||
@@ -46,7 +46,12 @@ func TestCreateFuncMap_DisabledInsecureFeatures(t *testing.T) {
|
||||
disableInsecureFeatures = currentVal
|
||||
}
|
||||
|
||||
// TODO: Remove this function once Helmfile v0.x
|
||||
func TestCreateFuncMap_SkipInsecureTemplateFunctions(t *testing.T) {
|
||||
if runtime.V1Mode {
|
||||
t.Logf("SkipInsecureTemplateFunctions is not supported in V1 mode")
|
||||
return
|
||||
}
|
||||
currentVal := skipInsecureTemplateFunctions
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user