vagrant-hostsupdater icon indicating copy to clipboard operation
vagrant-hostsupdater copied to clipboard

Off By Default

Open crussell52 opened this issue 9 years ago • 3 comments

Currently, this plugin "activates" if two standard config options.

In the case where I want the hosts file managed for one vagrant machine, I must alter the configurations for all other vagrant machines to avoid hosts file management.

I would like to see this plugin require a plugin-specific configuration flag to be turned on. For example:

config.hostsupdater.manage_hosts = true

This would make the plugin far less aggressive and would avoid users from scratching their head when they install a new box and forget about adding the "skip" parameter to their networking config.

This would also make it easy to temporarily disable the plugin in cases where there are multiple network configurations. (The alternative is altering every private network address.)

Note, that when this flag is disabled, the plugin should still perform clean up operations on the hosts file.

crussell52 avatar Dec 18 '15 21:12 crussell52

@crussell52 I do like this idea of having the plugin off by default - most other plugins have a mechanism to enable it. You bring up a good example of editing multiple VagrantFiles just to turn the plugin off. Where as you'd edit a few to turn the plugin on.

This would be a pretty major BC break though.

cgsmith avatar Jan 15 '16 01:01 cgsmith

what happens if the plugin is not installed and you got config.hostsupdater.manage_hosts = true in the Vagrantfile?

❱ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

VagrantPlugins::HostsUpdater::Config:
* The following settings shouldn't exist: manage_hosts

users would have to install the plugin - what in this case is completely irrelevant/optional for operation of the guest machine - or remove the entry to be able to get the guest machine up and running.

so personally i like the fact that i don't need to modify my guest machine Vagrantfile to update my host machine hosts file or not.

what could be nice tough:

vagrant up --disable-plugin=vagrant-hostsupdater

oskude avatar Feb 11 '16 15:02 oskude

@oskude you can always wrap the VagrantFile with this:

if Vagrant.has_plugin?("vagrant-hostsupdater")
    config.hostsupdater.manage_hosts = true
    # other vagrant-hostsupdater options
end

cgsmith avatar Feb 13 '16 03:02 cgsmith