Open marek-obuchowicz opened 8 years ago
Hey @marek-obuchowicz / @dkarlovi,
Can you test https://github.com/amontalban/vagrant-hostmanager/commit/09ef5194085614bb8259ca61bdb214f7853b1d03 on your setup? I had same issue (Configuring vagrant-hostmanager in base box) and that fixed.
I'm not a developer and my Ruby skills are super limited but I hope it helps.
If that works I can open an PR and maybe @seth-reeser can merge it.
Thanks!
@amontalban I will try it out monday and let you know, thanks.
@amontalban I'm sorry about this taking quite so long, but I do confirm that it does in fact work, I've removed
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
from my (thin) project Vagrantfile
and
vagrant hostmanager
updates /etc/hosts
, adding the entryvagrant destroy
updates /etc/hosts
, removing the entryvagrant up
updates /etc/hosts
, adding the entryPlease, create a PR so we can get this fixed. Thank you, great job!
@dkarlovi Sorry for the long delay, sure let me push a PR.
Thanks!
@dkarlovi I'm seeing that this is broke again with Vagrant 1.9
Working on a fix.
Sorry, it works it seems that Vagrant have an issue when installing plugins from remote repositories. Check mitchellh/vagrant#8210.
For now you can download this patched plugin and install it with:
vagrant plugin install vagrant-hostmanager-1.8.5.gem
You can download it from: https://packagecloud.io/amontalban/vagrant-hostmanager/packages/gems/vagrant-hostmanager-1.8.5.gem
I have configured hostmanager in Vagrantfile, then packaged it into box. When I'm creating a vm using
vagrant init <boxname>; vagrant up
- it doesn't respect hostmanager configuration from box file.I guess it comes from https://github.com/devopsgroup-io/vagrant-hostmanager/blob/master/lib/vagrant-hostmanager/action/update_host.rb#L13 -> it calls env[:global_env].vagrantfile which, according to documentation, "Represents the default Vagrantfile, or the Vagrantfile that is in the working directory or a parent of the working directory of this environment." - so it doesn't consider the value from merged configurations of all Vagrantfiles, just the one from file in current directory.