Skip to content

Commit

Permalink
fix: render return in dcl hook
Browse files Browse the repository at this point in the history
  • Loading branch information
robcxyz committed Dec 4, 2022
1 parent f2fa091 commit 9970987
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions tackle/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,7 @@ def function_walk(
walk_sync(context=tmp_context, element=input_element.copy())

if return_:
return_ = render_variable(tmp_context, return_)
if isinstance(return_, str):
if return_ in tmp_context.public_context:
return tmp_context.public_context[return_]
Expand Down
25 changes: 25 additions & 0 deletions tests/parser/functions/fixtures/return-render.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

compact->: some_function baz
expanded:
->: some_function
full: baz
global->: "{{some_function('baz')}}"
#filter->: "{{'baz'|some_function}}"


some_function<-:
full:
type: str
description: A description
default: a-default
compact: a-default

exec<-:
foo: bar
output: do
do->: var "{{full}}"

args:
- full

return: "{{output}}"
4 changes: 2 additions & 2 deletions tests/parser/functions/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from tackle import tackle

FIXTURES = [
# ('call.yaml', 'call-output.yaml'),
# ('return.yaml', 'return-output.yaml'),
('call.yaml', 'call-output.yaml'),
('return.yaml', 'return-output.yaml'),
('return-render.yaml', 'return-output.yaml'),
]

Expand Down

0 comments on commit 9970987

Please sign in to comment.