-
Notifications
You must be signed in to change notification settings - Fork 25
Allow to force vagrant provider in vagrant up #187
Conversation
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 am not a fans for "provider_force" since "provider" should already enough and align with original Vagrant command line and config file option. The problem we have is we didn't pass that "provider" parameter correctly to where it should associated underlaying command line option and config file, but leave it empty in our previous implementation so Vagrant need to guess with its own default style. IMHO, original implementation coming with a hidden bug, but not a feature. Adding additional redundant parameter for keeping a buggy implementation is not a fix but overkilling design... |
The vagrant command line doesn't force to use If your point is that one must always use
I do understand that but vagrant does the same. I can write my own Vagrantfile with configuration options for virtualbox and run
There's nothing specific to a provider in there, so why should I fail when run with vbox instead of libvirt ? The test is still fine, since we only care about So, imho, it's up to the user to ensure that the right provider is used with --provider. |
What if handle in this way:
My key point is: let’s align our config file behavior as similar as vagrant as possible, but not adding additional for handling that. P.S. empty provider NOT ALWAYS equal to VirtualBox, because we could change it from global environment variable VAGRANT_DEFAULT_PROVIDER, see https://www.vagrantup.com/docs/other/environmental-variables |
oh, I kind of like the idea. I've yet to check how to change the CI to cope with that. The CI is doing "clever" things to avoid changing the test scenario Also some work to deal with default ram/vcpu configuration as it's provider specific but I guess, not a big problem.
yeah, I know. Kind of makes life harder. |
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:
driver.provider.name
Overrided byVAGRANT_DEFAULT_PROVIDER
#174So, 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]