plancontext cleanup

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-12-07 14:20:08 -05:00
parent c881bc2dba
commit a58ca16c3d
8 changed files with 9 additions and 9 deletions

View File

@ -70,7 +70,7 @@ func (c importTask) Run(ctx context.Context, pctx *plancontext.Context, s solver
fs := pctx.FS.New(result) fs := pctx.FS.New(result)
out := compiler.NewValue() out := compiler.NewValue()
if err := out.FillPath(cue.ParsePath("fs"), fs.Value()); err != nil { if err := out.FillPath(cue.ParsePath("fs"), fs.MarshalCUE()); err != nil {
return nil, err return nil, err
} }
return out, nil return out, nil

View File

@ -38,7 +38,7 @@ func (c secretEnvTask) Run(ctx context.Context, pctx *plancontext.Context, _ sol
} }
secret := pctx.Secrets.New(env) secret := pctx.Secrets.New(env)
out := compiler.NewValue() out := compiler.NewValue()
if err := out.FillPath(cue.ParsePath("contents"), secret.Value()); err != nil { if err := out.FillPath(cue.ParsePath("contents"), secret.MarshalCUE()); err != nil {
return nil, err return nil, err
} }
return out, nil return out, nil

View File

@ -38,7 +38,7 @@ func (c secretFileTask) Run(ctx context.Context, pctx *plancontext.Context, _ so
secret := pctx.Secrets.New(string(plaintext)) secret := pctx.Secrets.New(string(plaintext))
out := compiler.NewValue() out := compiler.NewValue()
if err := out.FillPath(cue.ParsePath("contents"), secret.Value()); err != nil { if err := out.FillPath(cue.ParsePath("contents"), secret.MarshalCUE()); err != nil {
return nil, err return nil, err
} }
return out, nil return out, nil

View File

@ -10,7 +10,7 @@ func TestContext(t *testing.T) {
ctx := New() ctx := New()
secret := ctx.Secrets.New("test") secret := ctx.Secrets.New("test")
get, err := ctx.Secrets.FromValue(secret.Value()) get, err := ctx.Secrets.FromValue(secret.MarshalCUE())
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, "test", get.PlainText()) require.Equal(t, "test", get.PlainText())
} }

View File

@ -31,7 +31,7 @@ func (fs *FS) Result() bkgw.Reference {
return fs.result return fs.result
} }
func (fs *FS) Value() *compiler.Value { func (fs *FS) MarshalCUE() *compiler.Value {
v := compiler.NewValue() v := compiler.NewValue()
if err := v.FillPath(fsIDPath, fs.id); err != nil { if err := v.FillPath(fsIDPath, fs.id); err != nil {
panic(err) panic(err)

View File

@ -33,7 +33,7 @@ func (s *Secret) PlainText() string {
return s.plainText return s.plainText
} }
func (s *Secret) Value() *compiler.Value { func (s *Secret) MarshalCUE() *compiler.Value {
v := compiler.NewValue() v := compiler.NewValue()
if err := v.FillPath(secretIDPath, s.id); err != nil { if err := v.FillPath(secretIDPath, s.id); err != nil {
panic(err) panic(err)

View File

@ -39,7 +39,7 @@ func (s *Service) NPipe() string {
return s.npipe return s.npipe
} }
func (s *Service) Value() *compiler.Value { func (s *Service) MarshalCUE() *compiler.Value {
v := compiler.NewValue() v := compiler.NewValue()
if err := v.FillPath(serviceIDPath, s.id); err != nil { if err := v.FillPath(serviceIDPath, s.id); err != nil {
panic(err) panic(err)

View File

@ -193,7 +193,7 @@ type secretInput string
func (i secretInput) Compile(st *State) (*compiler.Value, error) { func (i secretInput) Compile(st *State) (*compiler.Value, error) {
secret := st.Context.Secrets.New(i.PlainText()) secret := st.Context.Secrets.New(i.PlainText())
return secret.Value(), nil return secret.MarshalCUE(), nil
} }
func (i secretInput) PlainText() string { func (i secretInput) PlainText() string {
@ -296,5 +296,5 @@ type socketInput struct {
func (i socketInput) Compile(st *State) (*compiler.Value, error) { func (i socketInput) Compile(st *State) (*compiler.Value, error) {
service := st.Context.Services.New(i.Unix, i.Npipe) service := st.Context.Services.New(i.Unix, i.Npipe)
return service.Value(), nil return service.MarshalCUE(), nil
} }