0.3.11 breaking `j2` usage of ENV vars in `docker-compose up`
See original GitHub issueOur docker-compose up
and ecs-cli up
(AWS Elastic Container Service (ECS)) deploys just started failing all of the sudden with:
appserver_1 | Traceback (most recent call last):
appserver_1 | File “/usr/local/bin/j2”, line 11, in <module>
appserver_1 | sys.exit(main())
appserver_1 | File “/usr/local/lib/python2.7/dist-packages/j2cli/cli.py”, line 206, in main
appserver_1 | sys.argv[1:]
appserver_1 | File “/usr/local/lib/python2.7/dist-packages/j2cli/cli.py”, line 186, in render_command
appserver_1 | result = renderer.render(args.template, context)
appserver_1 | File “/usr/local/lib/python2.7/dist-packages/j2cli/cli.py”, line 87, in render
appserver_1 | .render(context) \
appserver_1 | File “/usr/local/lib/python2.7/dist-packages/jinja2/environment.py”, line 1008, in render
appserver_1 | return self.environment.handle_exception(exc_info, True)
appserver_1 | File “/usr/local/lib/python2.7/dist-packages/jinja2/environment.py”, line 780, in handle_exception appserver_1 | reraise(exc_type, exc_value, tb)
appserver_1 | File “/templates/ssmtp.tpl”, line 8, in top-level template code
appserver_1 | rewriteDomain={{ SMTP_FROM_HOSTNAME }}
appserver_1 | jinja2.exceptions.UndefinedError: ‘SMTP_RELAY_HOST’ is undefined
These are containers that have an entrypoint script that uses j2
to copy a template file into a regular file.
j2 /templates/ssmtp.tpl > /etc/ssmtp/ssmtp.conf
I pinned the version back to 0.3.10 with pip install -Iv j2cli==0.3.10
in the Dockerfile and things are working again.
I recommend reverting https://github.com/kolypto/j2cli/pull/42 (today’s release) and pushing this out immediately until a correct patch/PR can be created as it is most likely breaking other builds and deployments. It took me a few hours to arrive here and others may be struggling with why this is happening to them as well.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
Wow, that’s unexpected. Sorry. I’ve pulled the breaking release from pip; will investigate and find out the root cause. Thank you for reporting!
Just had a look here https://github.com/kolypto/j2cli/commit/26a67e9419d96b7f92871e8b93dba00306c5df0b and that is quite the addition now! Thanks, I’ll see if I can test it soon, as I do need to revert the pin anyways. It may be Monday for my schedule. Thanks again