-
Notifications
You must be signed in to change notification settings - Fork 83
0.3.11 breaking j2 usage of ENV vars in docker-compose up #43
Description
Our 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
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 #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.