diff options
author | Vincent Ambo <tazjin@gmail.com> | 2017-05-04T15·24+0200 |
---|---|---|
committer | Vincent Ambo <tazjin@gmail.com> | 2017-05-04T16·45+0200 |
commit | 32ca64c50a0080198a924c4d9f7c18637b4a76f4 (patch) | |
tree | d39bba60623fa41977733ae807518d0fc3d26b50 /templater/templater.go | |
parent | 7286751db75187533c0c83dbd46162c14ca935a4 (diff) |
feat templater: Warn if no valid resource sets are included
After filtering resource sets, check whether any resource sets "survived". Otherwise it can be assumed that the user specified invalid exclude/include combinations and should be warned about that. Fixes #35
Diffstat (limited to 'templater/templater.go')
-rw-r--r-- | templater/templater.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/templater/templater.go b/templater/templater.go index 67e33a5355f1..9a00da3a75f6 100644 --- a/templater/templater.go +++ b/templater/templater.go @@ -33,6 +33,11 @@ type TemplatingError struct { func LoadAndPrepareTemplates(include *[]string, exclude *[]string, c *context.Context) (output []string, err error) { limitedResourceSets := applyLimits(&c.ResourceSets, include, exclude) + if len(*limitedResourceSets) == 0 { + fmt.Fprintln(os.Stderr, "No valid resource sets included!") + return + } + for _, rs := range *limitedResourceSets { err = processResourceSet(c, &rs, &output) |