-
Notifications
You must be signed in to change notification settings - Fork 25
driver.provider.name
Overrided by VAGRANT_DEFAULT_PROVIDER
#174
Conversation
7f8fd52
to
80d3ef5
Compare
Several comments:
[ btw, if we really adopt this change, I guess it'll meant doing a major release of molecule-vagrant to respect semver. I'll have to check that. ] |
Currently one of the failed test case is:
For semver, I guess we could provide a default value for this, e.g. virtualbox as vagrant default provider. Therefore existing user without specifying |
Some example why specify e.g. my molecule.yml for libvirt:
In case of virtualbox:
|
The test have been written are basic so they should work with libvirt and virtualbox. The provider used in reality doesn't matter
it's not a matter of default value since the module is already setting the default provider to virtualbox. The problem is that people doing things like what's done in the testsuite (and are happy with that) will now get failures. So this new behaviour is not compatible with previous one. Moreover, I'm not sure that there's a reliable way to know if vagrant using a different provider is fine or not for a given scenario. Think also about this very simple molecule.yml case:
With your change, it'll fail on systems with a different provider than virtualbox. Without it, things will just work. I guess that a better solution may be to add a new option (for instance "force_provider") to the vagrant module and set it according to a molecule_yml.driver.provider.force option. If it's set, pass the provider to vagrant the same way you did. And in this case, it'll even remain compatible with current behaviour. At last but not least, please, provide a test case if possible (I guess it should be enought to test something like getting an error if the provider in molecule_yml.driver.provider.name set to provider not installed is correctly giving an error). |
Currently, vagrant is still choosing the provider to use on its own liking. While it's fine for cases like our CI or people who are fine with default VM configurations, it's not always the case. See: - ansible-community#174 - https://github.com/ansible-community/molecule-vagrant/issues/181 So, add a new configuration setting to call vagrant up with --provider, in order to force the provider to use and lead to an error if it's not usable. The default value is to keep current behaviour to not break things. Signed-off-by: Arnaud Patard <[email protected]>
Currently, vagrant is still choosing the provider to use on its own liking. While it's fine for cases like our CI or people who are fine with default VM configurations, it's not always the case. See: - ansible-community#174 - https://github.com/ansible-community/molecule-vagrant/issues/181 So, add a new configuration setting to call vagrant up with --provider, in order to force the provider to use and lead to an error if it's not usable. The default value is to keep current behaviour to not break things. Signed-off-by: Arnaud Patard <[email protected]>
I've implemented what I suggested in #187. Would it solve your issue ? |
It could solve the issue technically, but I couldn't agree from KISS design principle... |
Currently, vagrant is still choosing the provider to use on its own liking. This may cause troubles like VM memory/cpus or provider options ignored if the provider use is not the one specified. See: - ansible-community#174 - https://github.com/ansible-community/molecule-vagrant/issues/181 So, pass --provider when the provider is set in the molecule.yml. If the test doesn't care about the provider, it should remove the provider name setting in the molecule.yml. Note: While this may break some setup, I believe this will prevent new reports/issues like the one previously noted. In case one molecule.yml file for multiple providers is wanted, use the new providers_options, as done in our CI scenario. Signed-off-by: Arnaud Patard <[email protected]>
Currently, vagrant is still choosing the provider to use on its own liking. This may cause troubles like VM memory/cpus or provider options ignored if the provider use is not the one specified. See: - ansible-community#174 - https://github.com/ansible-community/molecule-vagrant/issues/181 So, pass --provider when the provider is set in the molecule.yml. If the test doesn't care about the provider, it should remove the provider name setting in the molecule.yml. Note: While this may break some setup, I believe this will prevent new reports/issues like the one previously noted. In case one molecule.yml file for multiple providers is wanted, use the new providers_options, as done in our CI scenario. Signed-off-by: Arnaud Patard <[email protected]>
Hi @hswong3i, could you please rebase? |
In case environment variable `VAGRANT_DEFAULT_PROVIDER` is defined (see <https://www.vagrantup.com/docs/other/environmental-variables#vagrant_default_provider>), our `driver.provider.name` will have no effect and always start with above default provider as specifiied. With python-vagrant `up()` (see <https://github.com/pycontribs/python-vagrant/blob/main/src/vagrant/__init__.py#L310-L318>) we could specify the target provider with `provider` option, where our current wrapper only provide the `provision` option. Signed-off-by: Wong Hoi Sing Edison <[email protected]>
80d3ef5
to
06f9ec0
Compare
Currently, vagrant is still choosing the provider to use on its own liking. This may cause troubles like VM memory/cpus or provider options ignored if the provider use is not the one specified. See: - ansible-community#174 - https://github.com/ansible-community/molecule-vagrant/issues/181 So, pass --provider when the provider is set in the molecule.yml. If the test doesn't care about the provider, it should remove the provider name setting in the molecule.yml. Note: While this may break some setup, I believe this will prevent new reports/issues like the one previously noted. In case one molecule.yml file for multiple providers is wanted, use the new providers_options, as done in our CI scenario. Signed-off-by: Arnaud Patard <[email protected]>
Closed due to migration to https://github.com/ansible-community/molecule-plugins |
In case environment variable
VAGRANT_DEFAULT_PROVIDER
is defined (seehttps://www.vagrantup.com/docs/other/environmental-variables#vagrant_default_provider),
our
driver.provider.name
will have no effect and always start withabove default provider as specifiied.
With python-vagrant
up()
(seehttps://github.com/pycontribs/python-vagrant/blob/main/src/vagrant/__init__.py#L310-L318)
we could specify the target provider with
provider
option, where ourcurrent wrapper only provide the
provision
option.Signed-off-by: Wong Hoi Sing Edison [email protected]