Skip to content
Snippets Groups Projects
Unverified Commit 5f5defb6 authored by bryanl's avatar bryanl
Browse files

handle jsonnet ast.ApplyBrace in env files


Signed-off-by: default avatarbryanl <bryanliles@gmail.com>
parent 428c62dc
No related branches found
No related tags found
No related merge requests found
......@@ -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, ".")
......
......@@ -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)
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment