From b1c3e9ceb3f365f0ae1b6478a6fa75a8c3bcc2fa Mon Sep 17 00:00:00 2001 From: wawa0210 Date: Mon, 7 Dec 2020 18:20:16 +0800 Subject: [PATCH] Avoid overwriting the content of the template file Signed-off-by: wawa0210 --- cmd/helm/template.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmd/helm/template.go b/cmd/helm/template.go index 6123d29d4..eef9eb237 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -82,7 +82,6 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { var manifests bytes.Buffer fmt.Fprintln(&manifests, strings.TrimSpace(rel.Manifest)) if !client.DisableHooks { - fileWritten := make(map[string]bool) for _, m := range rel.Hooks { if client.OutputDir == "" { fmt.Fprintf(&manifests, "---\n# Source: %s\n%s\n", m.Path, m.Manifest) @@ -91,11 +90,10 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { if client.UseReleaseName { newDir = filepath.Join(client.OutputDir, client.ReleaseName) } - err = writeToFile(newDir, m.Path, m.Manifest, fileWritten[m.Path]) + err = writeToFile(newDir, m.Path, m.Manifest, true) if err != nil { return err } - fileWritten[m.Path] = true } }