You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.
My dummy test.j2 file contains: Hi {{ data_var | env_var | d('default_var') }}
My data_test.yaml contains: data_var: foo_yaml
I have set env_var via: export env_var='foo_env'
So, as per templating:
Case-1: j2 --undefined test.j2 data_test.yaml -o test should output Hi foo_yaml
Case-2: j2 --undefined test.j2 -o test should output Hi foo_env
Case-3: if I execute unset env_var and then execute j2 --undefined test.j2 -o test, it should output Hi default_var
But in all cases, it throws error:
Traceback (most recent call last):
File "/usr/local/bin/j2", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/j2cli/cli.py", line 206, in main
sys.argv[1:]
File "/usr/local/lib/python2.7/site-packages/j2cli/cli.py", line 186, in render_command
result = renderer.render(args.template, context)
File "/usr/local/lib/python2.7/site-packages/j2cli/cli.py", line 86, in render
.get_template(template_path) \
File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 830, in get_template
return self._load_template(name, self.make_globals(globals))
File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 804, in _load_template
template = self.loader.load(self, name, globals)
File "/usr/local/lib/python2.7/site-packages/jinja2/loaders.py", line 125, in load
code = environment.compile(source, name, filename)
File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 591, in compile
self.handle_exception(exc_info, source_hint=source_hint)
File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/tmp/test.j2", line 1, in template
Hi {{ data_var | env_var | d('default_var') }}
jinja2.exceptions.TemplateAssertionError: no filter named 'env_var'
So, not only piped templating doesn't happen, it also ignores --undefined
The text was updated successfully, but these errors were encountered:
My dummy test.j2 file contains:
Hi {{ data_var | env_var | d('default_var') }}
My data_test.yaml contains:
data_var: foo_yaml
I have set env_var via:
export env_var='foo_env'
So, as per templating:
Case-1:
j2 --undefined test.j2 data_test.yaml -o test
should outputHi foo_yaml
Case-2:
j2 --undefined test.j2 -o test
should outputHi foo_env
Case-3: if I execute
unset env_var
and then executej2 --undefined test.j2 -o test
, it should outputHi default_var
But in all cases, it throws error:
So, not only piped templating doesn't happen, it also ignores
--undefined
The text was updated successfully, but these errors were encountered: