From 420c3b776e2376cb0acaeeb69c4dff84efdff8cd Mon Sep 17 00:00:00 2001 From: Rajat Jindal Date: Sun, 19 Nov 2017 14:58:33 -0800 Subject: [PATCH] dont write blank files --- cmd/helm/template.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/helm/template.go b/cmd/helm/template.go index 75fed07f5..838fa74c2 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -41,6 +41,9 @@ import ( ) const defaultDirectoryPermission = 0755 + +var whitespaceRegex = regexp.MustCompile(`^\s*$`) + const templateDesc = ` Render chart templates locally and display the output. @@ -262,6 +265,10 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { } if t.outputDir != "" { + // blank template after execution + if whitespaceRegex.MatchString(data) { + continue + } writeToFile(t.outputDir, m.Name, data) continue }