fgrehm / vagrant-cachier

Caffeine reducer
http://fgrehm.viewdocs.io/vagrant-cachier
MIT License
1.07k stars 111 forks source link

Fix NFS configs for 1.4 #73

Closed fgrehm closed 10 years ago

fgrehm commented 10 years ago

This is the fix for GH-67 but as there are some open issues related to NFS with VirtualBox on Vagrant's core I can't really be sure that things are working fine (I think the one that consolidates them is https://github.com/mitchellh/vagrant/issues/2674). But since I was able to reproduce the original bug, this should be enough to fix things from our side and will allow people to use Vagrant < 1.4 as well.

@tuminoid would you mind installing the plugin from sources out of this branch and double checking that it works fine on vmware? If you need any help with that please LMK.

/cc @phinze

tuminoid commented 10 years ago

Building the 0.5.1.dev gem went OK (after setting up RVM and getting p353 so bundler can understand the "github:" part of the Gemfile), but vagrant plugin install pkg/... splashes a trace: /cc @mitchellh

$ vagrant plugin install pkg/vagrant-cachier-0.5.1.dev.gem 
You appear to be running Vagrant in a Bundler environment. Because
Vagrant should be run within installers (outside of Bundler), Vagrant
will assume that you're developing plugins and will change its behavior
in certain ways to better assist plugin development.

/Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/plugins/commands/plugin/action/install_gem.rb:3:in `require': cannot load such file -- rubygems/format (LoadError)
    from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/plugins/commands/plugin/action/install_gem.rb:3:in `<top (required)>'
    from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/plugins/commands/plugin/action.rb:12:in `block in action_install'
    from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/plugins/commands/plugin/action.rb:10:in `tap'
    from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/plugins/commands/plugin/action.rb:10:in `action_install'
    from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/plugins/commands/plugin/command/install.rb:27:in `execute'
    from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/plugins/commands/plugin/command/root.rb:52:in `execute'
    from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/lib/vagrant/cli.rb:38:in `execute'
    from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/lib/vagrant/environment.rb:478:in `cli'
    from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/bin/vagrant:96:in `<top (required)>'
    from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bin/vagrant:23:in `load'
    from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bin/vagrant:23:in `<main>'
    from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
    from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'

gem env:

$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.1.11
  - RUBY VERSION: 2.0.0 (2013-11-22 patchlevel 353) [x86_64-darwin13.0.0]
...

Gem list:

$ gem list

*** LOCAL GEMS ***

archive-tar-minitar (0.5.2)
bigdecimal (1.2.0)
bundler (1.3.5)
bundler-unload (1.0.2)
chef (11.6.0)
childprocess (0.3.9)
erubis (2.7.0)
executable-hooks (1.2.6)
ffi (1.9.0)
format (0.1.0)
gem-wrappers (0.9.2)
highline (1.6.19)
i18n (0.6.5)
io-console (0.4.2)
ipaddress (0.8.0)
json (1.7.7)
librarian (0.1.0)
librarian-chef (0.0.1)
log4r (1.1.10)
mime-types (1.23)
minitest (4.3.2)
mixlib-authentication (1.3.0)
mixlib-cli (1.3.0)
mixlib-config (1.1.2)
mixlib-log (1.6.0)
mixlib-shellout (1.2.0)
net-scp (1.1.2)
net-ssh (2.6.8)
net-ssh-gateway (1.2.0)
net-ssh-multi (1.1)
ohai (6.18.0)
psych (2.0.0)
rake (10.1.0, 0.9.6)
rdoc (4.0.0)
rest-client (1.6.7)
rubygems-bundler (1.4.2)
rvm (1.11.3.8)
systemu (2.5.2)
test-unit (2.0.0.0)
thor (0.18.1)
vagrant-librarian-chef (0.1.2)
vagrant-omnibus (1.1.2)
yajl-ruby (1.1.0)

Ideas?

fgrehm commented 10 years ago

Thanks for trying it out! Right now I'm away from the computer but I can see that the gem version of vagrant from bundler is being picked up.

I can't say it is the actual problem but would you be able to "re-export" your $PATH prepending the path to vagrant's bin dir and try installing again to check if it works?

I don't remember seeing any issues related to that error on vagrant's issue tracker.

Cheers,

Fábio Rehm Sent on the run On Dec 18, 2013 5:40 AM, "Tuomo Tanskanen" notifications@github.com wrote:

Building the 0.5.1.dev gem went OK (after setting up RVM and getting p353 so bundler can understand the "github:" part of the Gemfile), but vagrant plugin install pkg/... splashes a trace: /cc @mitchellhhttps://github.com/mitchellh

$ vagrant plugin install pkg/vagrant-cachier-0.5.1.dev.gem You appear to be running Vagrant in a Bundler environment. Because Vagrant should be run within installers (outside of Bundler), Vagrant will assume that you're developing plugins and will change its behavior in certain ways to better assist plugin development.

/Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/plugins/commands/plugin/action/install_gem.rb:3:in require': cannot load such file -- rubygems/format (LoadError) from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/plugins/commands/plugin/action/install_gem.rb:3:in<top (required)>' from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/plugins/commands/plugin/action.rb:12:in block in action_install' from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/plugins/commands/plugin/action.rb:10:intap' from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/plugins/commands/plugin/action.rb:10:in action_install' from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/plugins/commands/plugin/command/install.rb:27:inexecute' from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/plugins/commands/plugin/command/root.rb:52:in execute' from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/lib/vagrant/cli.rb:38:inexecute' from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/lib/vagrant/environment.rb:478:in cli' from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bundler/gems/vagrant-57e95323b660/bin/vagrant:96:in<top (required)>' from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bin/vagrant:23:in load' from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bin/vagrant:23:in

' from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in eval' from /Users/tumi/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in
'

gem env:

$ gem env RubyGems Environment:

  • RUBYGEMS VERSION: 2.1.11
  • RUBY VERSION: 2.0.0 (2013-11-22 patchlevel 353) [x86_64-darwin13.0.0] ...

Gem list:

$ gem list

* LOCAL GEMS *

archive-tar-minitar (0.5.2) bigdecimal (1.2.0) bundler (1.3.5) bundler-unload (1.0.2) chef (11.6.0) childprocess (0.3.9) erubis (2.7.0) executable-hooks (1.2.6) ffi (1.9.0) format (0.1.0) gem-wrappers (0.9.2) highline (1.6.19) i18n (0.6.5) io-console (0.4.2) ipaddress (0.8.0) json (1.7.7) librarian (0.1.0) librarian-chef (0.0.1) log4r (1.1.10) mime-types (1.23) minitest (4.3.2) mixlib-authentication (1.3.0) mixlib-cli (1.3.0) mixlib-config (1.1.2) mixlib-log (1.6.0) mixlib-shellout (1.2.0) net-scp (1.1.2) net-ssh (2.6.8) net-ssh-gateway (1.2.0) net-ssh-multi (1.1) ohai (6.18.0) psych (2.0.0) rake (10.1.0, 0.9.6) rdoc (4.0.0) rest-client (1.6.7) rubygems-bundler (1.4.2) rvm (1.11.3.8) systemu (2.5.2) test-unit (2.0.0.0) thor (0.18.1) vagrant-librarian-chef (0.1.2) vagrant-omnibus (1.1.2) yajl-ruby (1.1.0)

Ideas?

— Reply to this email directly or view it on GitHubhttps://github.com/fgrehm/vagrant-cachier/pull/73#issuecomment-30822435 .

tuminoid commented 10 years ago

Good news first: I have no idea why vagrant ended up in rvm (especially as version 1.3.6.dev, as I've never had gem version of vagrant nor a dev version of it), but removed it from path and now I can install cachier.

Bad news: nothing changed, no NFS for cachier...

tmatilai commented 10 years ago

I have no idea why vagrant ended up in rvm

vagrant-cachier (as most other plugins) has a development dependency on Vagrant. And as Vagrant is not distributed via rubygems any more, it fetches it straight from github. cachier hasn't locked down a specific version, thus fetching always the current master.

You probably have run bundle install at the time when master was still in 1.3.x.

@fgrehm can continue debugging the nfs. =)

phinze commented 10 years ago

Hi folks, good to see some movement here! :ice_cream:

@fgrehm I'm confused about all the activity around type: :nfs vs nfs: true - from my reading of the code, both forms should work in vagrant 1.4...

https://github.com/mitchellh/vagrant/blob/850c9ea7a6be538f7ce9788f64c7437642c6de4e/plugins/kernel_v2/config/vm.rb#L297-L299

BUT - testing this branch locally does seem to work on vmware! So I must be missing something. :see_no_evil:

fgrehm commented 10 years ago

@fgrehm I'm confused about all the activity around type: :nfs vs nfs: true - from my reading of the code, both forms should work in vagrant 1.4...

Oh, I remember running into some issues related to that on Vagrant's issue tracker and I thought that it had really changed in a backwards incompatible way. Thanks for pointing out that it wasn't :)

Either way, I'm pretty sure this fix the issue here on cachier as /etc/exports gets updated on my laptop with this patch, I don't know why but I'll try to have a look at it tomorrow.

tmatilai commented 10 years ago

I think the VMConfig#finalize! gets called in earlier phase, and the Provisioner code only after that.

There is also mitchellh/vagrant#2645 which is now fixed in Vagrant 1.4.1, but that should only affect VirtualBox.

tuminoid commented 10 years ago

Retested, rebooted and retested, nada. On my Mac, /etc/exports stays empty Vagrant 1.4.1, vmware-fusion plugin 2.2.3 and 0.5.1.dev of cachier.

Scratch that, after rebooting and also enabling the NFS for cachier (oops, mixing production with development) it works :-) Yay!

fgrehm commented 10 years ago

Thats weird, @phinze said it worked for him o.O Are u sure u are building the plugin from this PR branch and not from master?

Fábio Rehm Sent on the run

Retested, rebooted and retested, nada. On my Mac, /etc/exports stays empty Vagrant 1.4.1, vmware-fusion plugin 2.2.3 and 0.5.1.dev of cachier.

— Reply to this email directly or view it on GitHubhttps://github.com/fgrehm/vagrant-cachier/pull/73#issuecomment-30942457 .

tuminoid commented 10 years ago

It did work after all, see the fixed comment above. My bad.

fgrehm commented 10 years ago

No worries :) I wasn't able to dig into this today but I vote for merging this PR as is and cutting a new point release so that 1.4 users are not affected by the original bug.

What do you guys think?

tuminoid commented 10 years ago

:+1:

fgrehm commented 10 years ago

0.5.1 is coming out in a few minutes