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

Support vagrant-vbguest plugin #30

Merged
merged 9 commits into from
Oct 10, 2013
Merged

Support vagrant-vbguest plugin #30

merged 9 commits into from
Oct 10, 2013

Conversation

tmatilai
Copy link
Owner

Ensure the proxies are configured before vagrant-vbguest plugin. The plugin hooks to the VagrantPlugins::ProviderVirtualBox::Action::Boot action so it will get executed earlier than us now.

We need to hook to VagrantVbguest::Middleware if it is found. But as that action is only called on VM boot with VirtualBox provider, and the Provision action is still also called, we have to hook to both and add some flag for not configuring the machine twice.

Related issue: dotless-de/vagrant-vbguest#77

@tmatilai
Copy link
Owner Author

tmatilai commented Oct 6, 2013

Another challenge (besides of avoiding multiple executions) is that when hooking to VagrantVbguest::Middleware the configuration has to be done before passing the control to the next middleware action. With Provision actions the logic is kind of backwards...

@tmatilai
Copy link
Owner Author

tmatilai commented Oct 6, 2013

Ugh, yet another issue. It seems that it is not possible to hook after/before an action that has not been added to the middleware stack yet. And vagrant-vbguest plugin is loaded after proxyconf. Won't help to hook to VagrantPlugins::ProviderVirtualBox::Action::Boot either as VagrantVbguest::Middleware would still be injected in-between.

@tmatilai
Copy link
Owner Author

tmatilai commented Oct 7, 2013

This seems to be a blocker for me. I can't think of a way to hook proxyconf actions between VagrantPlugins::ProviderVirtualBox::Action::Boot and VagrantVbguest::Middleware, as the latter will be inserted to the middleware stack only after us.

Any help? @mitchellh, @fgrehm?

@fgrehm
Copy link

fgrehm commented Oct 7, 2013

@tmatilai you should be able to "force" vbguest to be loaded prior to doing your proxyconf magic. an example can be found at multiprovider-snap. Hope that helps :)

@tmatilai
Copy link
Owner Author

tmatilai commented Oct 7, 2013

@fgrehm Thanks! I thought about something like that but didn't try it out as it felt a bit "wrong" as we don't actually depend on the vbguest plugin. But maybe that's the only way. I'll play more with it tonight.

@fgrehm
Copy link

fgrehm commented Oct 7, 2013

I think that's fine, it's sort of like a "loose dependency" ;)

@tmatilai
Copy link
Owner Author

tmatilai commented Oct 7, 2013

I guess you're right. If the plugin is installed (i.e. VagrantVbguest defined), there shouldn't be problem to force the plugin loading. Thanks again!

A middleware class that builds and runs the stack based on the specified
block, but only once.
Our configuration actions are now run in an isolated Runner, so
we can do all the magic before calling the next middleware.
The middleware stack can now be safely hooked to many actions as it is
executed only once.
[ci skip]
@tmatilai
Copy link
Owner Author

Ok, this seems to be working. Testing and reviewing appreciated. =)

I'll at least add some tests for the Action::OnlyOnce class, but not tonight.

@fgrehm
Copy link

fgrehm commented Oct 10, 2013

I won't be able to test it today but looking at the code things seems to be fine :)
Oh, and good job on the Action::OnlyOnce too ;)

@tmatilai
Copy link
Owner Author

Thanks, Fábio!

The trap with OnlyOnce is that the block must always be the same (Proc) instance as that is used as a key. But I couldn't think of any other way without forcing the caller to specify the key explicitly. Still I'm quite happy with it. :)

@tmatilai
Copy link
Owner Author

I'll merge this and push a pre-release version to rubygems to make it easier for people to test. Seems to work fine on my manual testing. (I'll keep dreaming of the acceptance tests... :))

tmatilai added a commit that referenced this pull request Oct 10, 2013
Support vagrant-vbguest plugin
@tmatilai tmatilai merged commit d1e3f59 into master Oct 10, 2013
@tmatilai
Copy link
Owner Author

Released as v0.6.0.rc1, which can be installed by:

vagrant plugin install --plugin-source https://rubygems.org/ --plugin-prerelease vagrant-proxyconf

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

Successfully merging this pull request may close these issues.

2 participants