improved handling of p []cue.Selector

Signed-off-by: Richard Jones <richard@dagger.io>
This commit is contained in:
Richard Jones 2022-02-05 09:54:38 -07:00
parent a087161fbb
commit 3ce41fedf1
No known key found for this signature in database
GPG Key ID: CFB3A382EB166F4C

View File

@ -62,10 +62,10 @@ func (c *decodeSecretTask) Run(ctx context.Context, pctx *plancontext.Context, _
switch entry := i.(type) { switch entry := i.(type) {
case string: case string:
secret := pctx.Secrets.New(entry) secret := pctx.Secrets.New(entry)
path := cue.MakePath(append(p, cue.ParsePath("contents").Selectors()...)...) p = append(p, cue.ParsePath("contents").Selectors()...)
pathSelectors := path.Selectors() logPath := cue.MakePath(p[1 : len(p)-1]...)
logPath := cue.MakePath(pathSelectors[1 : len(pathSelectors)-1]...)
lg.Debug().Str("path", logPath.String()).Str("type", "string").Msg("found secret") lg.Debug().Str("path", logPath.String()).Str("type", "string").Msg("found secret")
path := cue.MakePath(p...)
output.FillPath(path, secret.MarshalCUE()) output.FillPath(path, secret.MarshalCUE())
case map[string]interface{}: case map[string]interface{}:
for k, v := range entry { for k, v := range entry {