Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged configuration from box vagrantfiles not used #182

Open
marek-obuchowicz opened this issue Mar 19, 2016 · 6 comments
Open

Merged configuration from box vagrantfiles not used #182

marek-obuchowicz opened this issue Mar 19, 2016 · 6 comments

Comments

@marek-obuchowicz
Copy link

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.

@dkarlovi
Copy link

Opened that in #131

amontalban added a commit to amontalban/vagrant-hostmanager that referenced this issue Jul 8, 2016
@amontalban
Copy link

Hey @marek-obuchowicz / @dkarlovi,

Can you test amontalban@09ef519 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!

@dkarlovi
Copy link

dkarlovi commented Jul 8, 2016

@amontalban I will try it out monday and let you know, thanks.

@dkarlovi
Copy link

dkarlovi commented Jul 26, 2016

@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 entry
  • vagrant destroy updates /etc/hosts, removing the entry
  • vagrant up updates /etc/hosts, adding the entry

Please, create a PR so we can get this fixed. Thank you, great job!

@amontalban
Copy link

@dkarlovi Sorry for the long delay, sure let me push a PR.

Thanks!

@amontalban
Copy link

amontalban commented Jan 17, 2017

@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 hashicorp/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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants