forklift
forklift copied to clipboard
Overriding plugin options does not seem to work
Heya,
trying to override some (hard-coded) defaults for the vagrant-hostmanager plugin here. I am using forklift as a library, which is documented here I want to use it, but not necessarily want to update the Hosts /etc/host file. So i tried the following:
- Create a plugins/custom-plugins/Vagrantfile in the root of my repo with the following contents:
module CustomPlugins
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if Vagrant.has_plugin?("vagrant-vbguest")
config.vbguest.enabled = false
end
if Vagrant.has_plugin?("vagrant-hostmanager")
config.hostmanager.enabled = true
config.hostmanager.manage_host = false
end
end
end
- Create a link to this file inside of forklift/plugins (
ln -s ../../my-custom-plugins .
) -
vagrant up
a machine and observe that the overrides are ignored. The file does not seem to get loaded at all. If i manually comment the relevant parts inbox_distributor.rb
it will work.
Is this the right[TM] way of doing things or am i on a completely wrong path? I would like to use forklift as a general boiler-plate for my vagrant environments and need to override certain plugin options depending on the environment i am working with.
I think https://github.com/theforeman/forklift/blob/c10243609452845993cdf0a95e39f887e2f5474b/lib/forklift/box_distributor.rb#L108-L114 overrides this anyway disregarding your changes. That can't currently be overridden and would need a patch.
@mattiasgiese I think the broader solution might be to make the hostmanager options configurable at the box level similar to how other things like memory/cpu/etc. are. Would that solve your problem?
Well, yeah, making all relevant parameters configurable (not only hostmanager but other used plugins as well) would certainly help me.