From f5a1463b28eaa04a0dc0da4c2a36ba911586eaca Mon Sep 17 00:00:00 2001 From: Jessica Yuen <im.jessicayuen@gmail.com> Date: Wed, 15 Nov 2017 09:43:07 -0800 Subject: [PATCH] Expand non-Jsonnet prototypes using the textmate snippet parser --- cmd/prototype.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/prototype.go b/cmd/prototype.go index 419adec6..8e552313 100644 --- a/cmd/prototype.go +++ b/cmd/prototype.go @@ -24,6 +24,7 @@ import ( "github.com/ksonnet/ksonnet/metadata" "github.com/ksonnet/ksonnet/prototype" + "github.com/ksonnet/ksonnet/prototype/snippet" "github.com/ksonnet/ksonnet/prototype/snippet/jsonnet" "github.com/ksonnet/ksonnet/utils" "github.com/spf13/cobra" @@ -450,9 +451,11 @@ func expandPrototype(proto *prototype.SpecificationSchema, templateType prototyp componentsText = fmt.Sprintf(`components["%s"]`, componentName) } template = append([]string{`local params = std.extVar("` + metadata.ParamsExtCodeKey + `").` + componentsText + ";"}, template...) + return jsonnet.Parse(componentName, strings.Join(template, "\n")) } - return jsonnet.Parse(componentName, strings.Join(template, "\n")) + tm := snippet.Parse(strings.Join(template, "\n")) + return tm.Evaluate(params) } func getParameters(proto *prototype.SpecificationSchema, flags *pflag.FlagSet) (map[string]string, error) { -- GitLab