paulczar / meez

rubygem to set up opinionated TDD chef cookbook
73 stars 17 forks source link

Rake task complaining about vagrant gem missing #12

Open mattstratton opened 10 years ago

mattstratton commented 10 years ago
~/src/cookbooks/meez_cookbook (master)*$ bundle exec rake
rake aborted!
Expected process to exit with [0], but received '1'
---- Begin output of vagrant --version ----
STDOUT: 
STDERR: /usr/local/var/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/bundler-1.5.2/lib/bundler/rubygems_integration.rb:240:in `block in replace_gem': vagrant is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
    from /usr/local/var/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/bin/vagrant:22:in `<main>'
---- End output of vagrant --version ----
Ran vagrant --version returned 1
/Users/mstratton/src/cookbooks/meez_cookbook/Rakefile:37:in `new'
/Users/mstratton/src/cookbooks/meez_cookbook/Rakefile:37:in `<top (required)>'

If vagrant is no longer a gem, why would I need to add it to the gemfile?

paulczar commented 10 years ago

I think TK needs a vagrant gem ?

mattstratton commented 10 years ago

Hmm. What's odd is that I am able to use TK on this same workstation with no issues.

I suppose I could manually add vagrant to the gemfile, but it seems to me that needing to do this would be counter to how meez is supposed to work?

mattstratton commented 10 years ago

No, that's no good - because the vagrant gem that gets installed is not v2, and the Vagrantfile created by meez is a v2 file, so it breaks.

paulczar commented 10 years ago

yeah, I'm not sure what it is then ... I haven't had any vagrant gem issues on OSX ... what OS are you running ?

mattstratton commented 10 years ago

Mavericks

paulczar commented 10 years ago

reading back through the Rakefile I don't see anything other than TK in there that might want vagrant. can you run bundle exec kitchen test from inside the repo dir ?

Maybe @sethvargo could offer some suggestion?

mattstratton commented 10 years ago

I tried creating a fresh cookbook to see...same issue. This is the result of bundle exec kitchen test

~/src/cookbooks/meez2-cookbook (master)*$ bundle exec kitchen test
-----> Starting Kitchen (v1.2.1)
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ShellOut::ShellCommandFailed
>>>>>> Message: Expected process to exit with [0], but received '1'
---- Begin output of vagrant --version ----
STDOUT: 
STDERR: /usr/local/var/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/bundler-1.5.2/lib/bundler/rubygems_integration.rb:240:in `block in replace_gem': vagrant is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
    from /usr/local/var/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/bin/vagrant:22:in `<main>'
---- End output of vagrant --version ----
Ran vagrant --version returned 1
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

I wonder if there is a conflict that I have TK 1.2.1 on my system?

paulczar commented 10 years ago

Can you make sure you have these in your Gemfile ?

gem 'test-kitchen'
gem 'kitchen-vagrant'

can you also run vagrant --version and paste your results ?

mattstratton commented 10 years ago

I confirmed both gems are in the Gemfile.

When I run vagrant --version from within the cookbook, I get this result:

~/src/cookbooks/meez2-cookbook (master)*$ vagrant --version
/Users/mstratton/src/cookbooks/meez2-cookbook/Vagrantfile:4:in `<top (required)>': undefined method `configure' for Vagrant:Module (NoMethodError)
    from /usr/local/var/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/vagrant-0.5.4/lib/vagrant/environment.rb:198:in `load'
    from /usr/local/var/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/vagrant-0.5.4/lib/vagrant/environment.rb:198:in `block in load_config!'
    from /usr/local/var/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/vagrant-0.5.4/lib/vagrant/environment.rb:196:in `each'
    from /usr/local/var/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/vagrant-0.5.4/lib/vagrant/environment.rb:196:in `load_config!'
    from /usr/local/var/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/vagrant-0.5.4/lib/vagrant/environment.rb:139:in `load!'
    from /usr/local/var/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/vagrant-0.5.4/lib/vagrant/environment.rb:35:in `load!'
    from /usr/local/var/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/vagrant-0.5.4/lib/vagrant/command.rb:12:in `execute'
    from /usr/local/var/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/vagrant-0.5.4/bin/vagrant:7:in `<top (required)>'
    from /usr/local/var/rbenv/versions/1.9.3-p448/bin/vagrant:23:in `load'
    from /usr/local/var/rbenv/versions/1.9.3-p448/bin/vagrant:23:in `<main>'
    from /usr/local/var/rbenv/versions/1.9.3-p448/bin/ruby_noexec_wrapper:14:in `eval'
    from /usr/local/var/rbenv/versions/1.9.3-p448/bin/ruby_noexec_wrapper:14:in `<main>'
~/src/cookbooks/meez2-cookbook (master)*$ 

If I run it outside the cookbook, I get this error:

=====================================================================
Vagrant experienced an error!

Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed.
If VirtualBox is installed, it may be an incorrect version. Vagrant currently
requires VirtualBox 3.2.x. Please install the proper version to continue.
=====================================================================

If I run it inside a cookbook that was created with Berkshelf "by hand", I get this result: Vagrant 1.4.3

jeremyolliver commented 10 years ago

@mattstratton Note that vagrant used to be packaged as a gem, but no longer is. The fact that something's trying to activate a gem binary is probably a bit of a hangover from that. I've had troubles with varying tools such as: rbenv shims having a reference to a vagrant binary in other ruby versions, or shell aliases setup replacing vargrant with bundle exec vagrant.

I recommend checking each ruby version you have installed on your machine for: gem list | grep vagrant and uninstalling any vagrant or vagrant-wrapper that shows up.

mr--white commented 10 years ago

i removed the gem version of vagrant and installed the os x binary install version. it's at 1.5.1 now. Made sure that particular vagrant is in my path. Then ran bundle exec rake again. Worked like a charm.