-
Notifications
You must be signed in to change notification settings - Fork 667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use of autoescape=True in Jinja template breaks Vagrant #3912
Comments
I hoped I fixed everything in ansible-community/molecule-plugins@7eab71d. Looks like it's not the case. Can you open a bug on molecule-plugins with:
I'm not sure that disabling auto-escaping in molecule will happen since on general case it's a matter of security, so it's better to fix the template. If/When ansible-community/molecule-plugins#142 is merged, it may be considered to disable auto-escaping since it won't impact molecule. |
I was afraid of this response. 😄 I'm not sure I buy the security argument since this is a testing harness and templates are used to generate files but I'm not going to die on that hill. I can look at the template. I already started and did exactly what you did; add the Plus, there are vars that come from config options, like
Ref: ansible-community/molecule-plugins#60 Perhaps a middle ground is to create a new function Lastly, the Jinja docs seem to reference this very issue: If #142 is going to get merged soon and we can go back to old behavior, that may save a lot of headache for everyone. |
I added a PR with the additional safe filters: Sorry I don't have a test with it. |
Here's the issue I opened in molecule-plugins: In the PR you'll find a fix and test to the |
Issue Type
Molecule and Ansible details
Molecule installation method (one of):
Ansible installation method (one of):
Detail any linters or test runners used:
Desired Behavior
Jinja2 should generate correct Vagrant config files as it did in molecule <= v4.
Actual Behavior
This line:
https://github.com/ansible-community/molecule/blob/main/src/molecule/util.py#L178
from this PR introduced the regression.
Briefly, quoted strings that used to be output in the Vagrantfile, are now escaped.
molecule-vagrant no longer works.
Here's a line from the template that I'm using as an example. There's plenty more in there.
https://github.com/ansible-community/molecule-vagrant/blob/main/molecule_vagrant/modules/vagrant.py#L222
Here's my PR that adds a simple test of quoted strings in Jinja2 templates:
#3911
Summary
My ask is that
autoescape
be turned off when rendering templates.The text was updated successfully, but these errors were encountered: