Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion operator/poolboy_templating.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class TemplateVariable(object):
'''Variable may contain template string referencing other variables.'''
def __init__(self, value):
self.value = value
self.j2template = j2template_get(value) if '{{' in value else None
self.j2template = j2template_get(value) if '{{' in value or '{%' in value else None

def get_typed_value(self):
if self.j2template:
Expand Down
12 changes: 12 additions & 0 deletions test/unittest-poolboy_templating.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,5 +623,17 @@ def test_45(self):
True
)

def test_46(self):
template = "{% if show_a %}a{% endif %}"
template_variables = {
"show_a": True,
}
self.assertEqual(
recursive_process_template_strings(
template, template_variables=template_variables
),
"a",
)

if __name__ == '__main__':
unittest.main()