garrettux / knife-vagrant

Knife plugin for testing Chef code in a Vagrant VM
25 stars 15 forks source link

Dependency conflict when using knife-vagrant with latest versions of Chef and Vagrant gems #12

Open teejayvanslyke opened 11 years ago

teejayvanslyke commented 11 years ago

I've just installed Chef and Vagrant via Rubygems:

chef $ >> knife -v
Chef: 11.4.0
chef $ >> vagrant -v
Vagrant version 1.0.6

When running knife vagrant server create, I get the following error:

/Users/teejayvanslyke/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1637:in `raise_if_conflicts': Unable to activate vagrant-1.0.6, because json-1.7.3 conflicts with json (~> 1.5.1) (Gem::LoadError)
    from /Users/teejayvanslyke/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:746:in `activate'
    from /Users/teejayvanslyke/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems.rb:212:in `rescue in try_activate'
    from /Users/teejayvanslyke/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems.rb:209:in `try_activate'
    from /Users/teejayvanslyke/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
    from /Users/teejayvanslyke/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from /Users/teejayvanslyke/.rvm/gems/ruby-1.9.3-p194/gems/knife-vagrant-0.0.7/lib/chef/knife/vagrant_server.rb:72:in `block in <class:VagrantServerCreate>'
    from /Users/teejayvanslyke/.rvm/gems/ruby-1.9.3-p194/gems/chef-11.4.0/lib/chef/knife.rb:209:in `call'
    from /Users/teejayvanslyke/.rvm/gems/ruby-1.9.3-p194/gems/chef-11.4.0/lib/chef/knife.rb:209:in `load_deps'
    from /Users/teejayvanslyke/.rvm/gems/ruby-1.9.3-p194/gems/chef-11.4.0/lib/chef/knife.rb:170:in `run'
    from /Users/teejayvanslyke/.rvm/gems/ruby-1.9.3-p194/gems/chef-11.4.0/lib/chef/application/knife.rb:123:in `run'
    from /Users/teejayvanslyke/.rvm/gems/ruby-1.9.3-p194/gems/chef-11.4.0/bin/knife:25:in `<top (required)>'
    from /Users/teejayvanslyke/.rvm/gems/ruby-1.9.3-p194/bin/knife:19:in `load'
    from /Users/teejayvanslyke/.rvm/gems/ruby-1.9.3-p194/bin/knife:19:in `<main>'
    from /Users/teejayvanslyke/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/teejayvanslyke/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'

I'm pretty sure Vagrant is trying to load a different version of the JSON gem than is already loaded by Chef, which is incompatible with its requirements. I know a change is probably necessary in Vagrant, but I figured I'd post it here since Vagrant on its own seems unaffected.

claco commented 11 years ago

@garrettux @teejayvanslyke I've asked @spheromak to make this a PR for this issue: https://github.com/kt-cloudware/knife-vagrant/commit/5f303e55d62525a4b7002e8aad735bb7aff37efe

I'd love to see an updated gem out of this. Please. :-)

spheromak commented 11 years ago

@claco see #17

claco commented 11 years ago

@garrettux @teejayvanslyke @spheromak Honestly, I'm considering a fork and/or rewrite I think. I'm trying to use this plugin inside of spiceweasel to orchestrate testing infras in vagrant as well as the usual cloud plugins like aws, digitial ocean, rackspace, etc.

/tangent: I'm using spiceweasel as it just outputs knife commands, which allows me to upload roles/databags, etc once a chef-server cookbook is converged on a fresh node.

When it comes to vagrant, it would be nice to have the ability to use an existing Vagrantfile with the servers pre configured. This gives the ultimate level of flexibility as the template built into this version will never be as flexible.

knife vagrant server create would exec vagrant up which would be in an existing Vagrantfile.

As of now, knife vagrant server create is a noop, and it appears create only creates when given a -H hostname.

Maybe a knife-vagrantfile would be more appropriate. Thoughts?

spheromak commented 11 years ago

@ciaco yea That was what I was doing with it originally, but Vagrant + vagrant-chef-zero has replaced the spice/knife-vagrant combo for me. We are also using kitchen + vagabond right now for mult-node testing. With vagrant being able to drive ec2 it made less sens for me to continue using spice. Tho I still like spice. Before all of that I was wanting to redo this to be more chef-workflow-like.

What I do now with Vagrant files is just use env vars to control what "topology" someone wants. those are just evaled in the vagrant run, and some of the topologies have .json configs for the VM's. This way developers can spin up a 2node or 16 node cluster on localhost or on ec2/openstack. just by saying vm_layout="big_thing" vagrant up. So far this is working nicely. vagrant-chef-zero and vagrant-berkshelf are doing all the work.

claco commented 11 years ago

@spheromak I'm still a little scared of chef-zero. Just this week someone found a search bug that only happened in it vs. chef-server. This is too be expected for a while of course.

spheromak commented 11 years ago

lol @ciaco that was my co-worker and I who found that search bug :) Other than that. we haven't found any issues other than that. I ran into some weird depsolving issue, but wasn't zeros. problem. Tho it's interesting cause Berkshelf chef-server and chef-zero all use different dep-solving approaches.

vagabond does support arbitrary cluster layouts and usage of chef server as well as running kitchen on single nodes. +1 worth trying out. SpiceWeasel is also pretty cool, but the vagrant 1.1+ stuff made this aproach a bit more work than I had wanted it to be.