From 5f5defb63c02df1f746df2a45c6920ed56e8c106 Mon Sep 17 00:00:00 2001
From: bryanl <bryanliles@gmail.com>
Date: Mon, 26 Mar 2018 18:10:44 -0400
Subject: [PATCH] handle jsonnet ast.ApplyBrace in env files

Signed-off-by: bryanl <bryanliles@gmail.com>
---
 actions/param_set.go      | 9 +++++++--
 metadata/params/params.go | 2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/actions/param_set.go b/actions/param_set.go
index d7b70696..5eceef47 100644
--- a/actions/param_set.go
+++ b/actions/param_set.go
@@ -16,6 +16,7 @@
 package actions
 
 import (
+	"strconv"
 	"strings"
 
 	"github.com/ksonnet/ksonnet/component"
@@ -100,14 +101,18 @@ func NewParamSet(ksApp app.App, name, path, value string, opts ...ParamSetOpt) (
 
 // Run runs the action.
 func (ps *ParamSet) Run() error {
-
 	value, err := params.DecodeValue(ps.rawValue)
 	if err != nil {
 		return errors.Wrap(err, "value is invalid")
 	}
 
+	evaluatedValue := ps.rawValue
+	if _, ok := value.(string); ok {
+		evaluatedValue = strconv.Quote(ps.rawValue)
+	}
+
 	if ps.envName != "" {
-		return ps.setEnv(ps.app, ps.envName, ps.name, ps.rawPath, ps.rawValue)
+		return ps.setEnv(ps.app, ps.envName, ps.name, ps.rawPath, evaluatedValue)
 	}
 
 	path := strings.Split(ps.rawPath, ".")
diff --git a/metadata/params/params.go b/metadata/params/params.go
index da12d76f..014130a0 100644
--- a/metadata/params/params.go
+++ b/metadata/params/params.go
@@ -63,6 +63,8 @@ func findComponentsObj(node ast.Node) (*ast.Object, error) {
 			}
 		}
 		return nil, fmt.Errorf("Invalid params schema -- there must be a top-level object '%s'", componentsID)
+	case *ast.ApplyBrace:
+		return findComponentsObj(n.Right)
 	}
 	return nil, fmt.Errorf("Invalid params schema -- did not expect node type: %T", node)
 }
-- 
GitLab