ansible-community / molecule-plugins

Collection on molecule plugins
MIT License
101 stars 67 forks source link

Vagrant template generating incorrect Vagrantfile due to autoescape #158

Closed samiam closed 7 months ago

samiam commented 1 year ago

The Vagrantfile template isn't using the safe filter in all the locations needed. This results in a invalid Vagrantfile being generated.

This bug was introduced in molecule v5.0.1 due to the use of autoescape when calling Jinja2. Details of this problem can be found here: https://github.com/ansible-community/molecule/issues/3912

The request in that issue was to create a bug report in molecule-plugins with a test.

So, the PR here has both a fix and a test included. https://github.com/ansible-community/molecule-plugins/pull/153

Unfortunately I couldn't get the Vagrant tests to work, and looking through the issues log, this appears to be a known issue. But the tests, when run manually, work ok.

The only other change in that PR was to change the Vagrantbox from jessie64 to stretch64. This is due to jessie being archived. The repo.conf could be updated, or jessie box rebuilt, etc. but I went the easy route. Here's the jessie64 errors for posterity.

W: Failed to fetch http://security.debian.org/dists/jessie/updates/main/source/Sources  404  Not Found [IP: 151.101.194.132 80]
W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/main/source/Sources  404  Not Found [IP: 199.232.30.132 80]
W: Failed to fetch http://security.debian.org/dists/jessie/updates/main/binary-amd64/Packages  404  Not Found [IP: 151.101.194.132 80]
W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/main/binary-amd64/Packages  404  Not Found [IP: 199.232.30.132 80]

E: Some index files failed to download. They have been ignored, or old ones used instead.
E: There are problems and -y was used without --force-yes
sulaweyo commented 1 year ago

Guess i run into the same issue with box_url and box_version having encoded characters which make the Vagrantfile invalid c.vm.box_version = &#34;<version>&#34; c.vm.box_url = &#34;<url>&#34;

apatard commented 1 year ago

I've just merge PR #153. Should we close this bug ?

samiam commented 1 year ago

Sure.

In hindsight, debian/buster64 is a little more recent box, but it's ok.

When will a new molecule-plugin version be cut?

Thank again.

apatard commented 1 year ago

Sure.

In hindsight, debian/buster64 is a little more recent box, but it's ok.

I guess that anyway I'll sooner or later make a PR to update test boxes to newer ones like bullseye or even bookworn. Same for alpine ones. That's why I didn't annoy you with that.

When will a new molecule-plugin version be cut?

I don't know. I hope soon but it would be nice to get some more PR merged before releasing.

samiam commented 1 year ago

I don't know. I hope soon but it would be nice to get some more PR merged before releasing.

"Release early, release often" 😄

A new ansible creator-ee was just released. As more people pick up 5.0.1, more will encounter this bug. I feel like getting ahead of this bug vs getting more PRs merged is the prudent thing. 🤷

hluaces commented 1 year ago

This has been ongoing for a while now. Any reason as to not ship the fix on a new version?

duckinator commented 12 months ago

Just encountered this as well.

hal58th commented 11 months ago

Please release this!

samiam commented 11 months ago

This can be closed as it was fixed in #153 and released is 23.5.0. https://github.com/ansible-community/molecule-plugins/releases/tag/v23.5.0