Skip to content
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

Fix: Ensure Vagrant default provisioning mode is "once" #107

Closed
wants to merge 1 commit into from

Conversation

Berbe
Copy link

@Berbe Berbe commented Mar 10, 2023

Considering:

The Molecule's Vagrant plugin currently override the default value, defaulting to False, and only settable to True (None is rejected, not being a boolean).
This PR suggests a change so the default value of the Molecule plugin is aligned with python-vagrant's one, and eventually with Vagrant's behaviour.

@github-actions github-actions bot added the bug Something isn't working label Mar 10, 2023
@apatard
Copy link
Member

apatard commented Mar 13, 2023

I can't find the reason for it in git but I think that disabling the provisionning step of vagrant is done on purpose. Since ansible is used later, the instance configuration is supposed to be done with the prepare step. If the problem is missing python for ansible, it can probably be done with the raw module.

What the problem you're having exactly / you're trying to solve ? I don't see that explained clearly in your description.

@Berbe
Copy link
Author

Berbe commented Mar 13, 2023

This is a very surprising stance!
Are you saying the molecule-plugins project decides for users what's good for them with Vagrant?
If you prefer to keep the current default value, that is no problem: all I am requesting is a way to override it when so wished.

Vagrant provides 3 options for provisioning:

  • Always
  • Once
  • Never

python-vagrant provides the means to leverage all those three options.
... and the vagrant module of molecule-plugins withdraws one options from users, hence disempowering them.

Where the provisioning shall be done is to be decided on a case-by-case basis.
Not all provisioning steps apply to all available plugins, hence the prepare step is not necessarily the sane choice.

@apatard
Copy link
Member

apatard commented Mar 14, 2023

This is a very surprising stance! Are you saying the molecule-plugins project decides for users what's good for them with Vagrant? If you prefer to keep the current default value, that is no problem: all I am requesting is a way to override it when so wished.

I was trying to say that some author of the project has chosen some default, possibly due to the fact that the provisionning should rather be done with molecule prepare step. Of course, it should be possible to override the default and your problem (if I finally understood correctly) is that you can't override it with the value you want. The problem is not the default value.

Vagrant provides 3 options for provisioning:

* Always

* Once

* Never

python-vagrant provides the means to leverage all those three options. ... and the vagrant module of molecule-plugins withdraws one options from users, hence disempowering them.

I've not tested on my test VM but looks like your change is only changing the default value to match the missing use case instead of properly adding support for it. As long as this PR is modifying the default plugin behavior, imho, this PR is wrong.

@Berbe
Copy link
Author

Berbe commented Mar 18, 2023

As long as this PR is modifying the default plugin behavior, imho, this PR is wrong.

The molecule plugin is changing the default Vagrant and python-vagrant behaviour. How wrong is that?
I'm suggesting to converge on it.

@apatard
Copy link
Member

apatard commented Mar 21, 2023

I don't see the problem with current molecule-vagrant default behavior. Bootstrapping is supposed to be handled by create.yml or prepare.yml playbooks of molecule, that's their purpose. If this can't be done with molecule, then obviously, it should be possible to configure things to run vagrant provisioning step. And that's were the problem is, since you can't run it "once".
fwiw, I'm not even sure that since commit is correct. I've not checked but I expect ansible to complain that None is not a valid boolean. Please, don't rely on the CI when modifying molecule-vagrant things since the CI is not running molecule-vagrant tests.

@SeanMooney
Copy link

i think there is a disconnect here between what the role of python-vagrant and the molecues vagreant plug.

python-vagrant provides python binding for interacting with vagrant with the intent of maintaining the same behavior of vagrent.

the molecule vagrant plugin shoudl be consitent with the other plugins.
the intent of the plugin is to provide a way to create a test envionment with vgagrent just as the podman plugin creates a test envionment with podman.

but that does not mean all of the defaults should be the same as the backend provider.
instead the plugins should try to maintian consitent behaivor between the plugsins.

so it makes sense form a molecule plugin point of view to prefer having one standard way to provision the host using the prepare playbooks.

so i tend to agree with apatard.

i would not change the default to align with vagrant.

what could be done is change the type form bool to an enum of exposing the 3 backend values
using the following molecule to vagrant mapping

false -> never (default)
once -> once (this would be the new functionaly)
true -> always

in code the strign enums will have to be converted to a bool when invoking python-vagrant

'false' -> False
'once' -> None
'true' -> True

that makes the plugin code a little more

the other thing that might work without code change would be to try using the yaml null value instead of the string 'none'.

null when parsed into python should get converted to python None

if that works the docs could just get updates to detail that usage.

@hswong3i
Copy link
Contributor

I have a fix ansible-community/molecule-vagrant#174 before migration, and now as #155 which is working fine for my daily CI.

@ssbarnea ssbarnea closed this Jun 18, 2024
@Berbe
Copy link
Author

Berbe commented Jun 18, 2024

Issue closing duly noted. I will have tried.
Has this been a waste of my time?

python-vagrant provides python binding for interacting with vagrant with the intent of maintaining the same behavior of vagrent.

This is precisely what I was attempting to address: the molecule Vagrant plugin differs from Vagrant behaviour-wise.
Please re-read my original post, and all my subsequent answers.

@Berbe Berbe deleted the fix/vagrant/provision branch June 18, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vagrant
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants