Skip to content

Commit

Permalink
Pipeline: Don't wrap snapshot in template engine in "Data"
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Kosegi <richard.kosegi@gmail.com>
  • Loading branch information
rkosegi committed Aug 13, 2024
1 parent bfb0197 commit 3803ae8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions pipeline/template_op.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ func (ts *TemplateOp) Do(ctx ActionContext) error {
if len(ts.Path) == 0 {
return ErrPathEmpty
}
val, err := ctx.TemplateEngine().Render(ts.Template, map[string]interface{}{
"Data": ctx.Snapshot(),
})
val, err := ctx.TemplateEngine().Render(ts.Template, ctx.Snapshot())
ctx.Data().AddValueAt(ts.Path, dom.LeafNode(val))
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pipeline/template_op_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestExecuteTemplateOp(t *testing.T) {
gd = b.Container()
gd.AddValueAt("root.leaf1", dom.LeafNode(123456))
ts = TemplateOp{
Template: `{{ (mul .Data.root.leaf1 2) | quote }}`,
Template: `{{ (mul .root.leaf1 2) | quote }}`,
Path: "result.x1",
}
assert.NoError(t, New(WithData(gd)).Execute(&ts))
Expand Down

0 comments on commit 3803ae8

Please sign in to comment.