matschaffer / knife-solo

DEPRECATED: Please consider using https://knife-zero.github.io/, ansible, or visit https://www.chef.io/ for other ideas
MIT License
786 stars 213 forks source link

knife-solo is picking chef version from system gems when chefdk is used #425

Open janskarvall opened 9 years ago

janskarvall commented 9 years ago

Before executing knife solo prepare user@host I had installed chef on the host as described in First steps with Chef, i.e by running curl -L https://www.opscode.com/chef/install.sh | bash as root on the host.

However, running knife solo prepare user@host warned that chef had been downgraded:

dpkg: warning: downgrading chef from 12.1.0-1 to 12.0.3-1

Should I worry about that?

The only thing I found to be changed on the host was, besides the downgrade, was the file /home/user/install.sh, which I believe is the script that made the install of chef.

Am I right?

matschaffer commented 9 years ago

What version of chef to you have on your workstation? Knife-solo should try to install the same version on the server as you have on your workstation.

2015年3月4日水曜日、janskarvallnotifications@github.comさんは書きました:

Before executing knife solo prepare user@host I had installed chef on the host as described in First steps with Chef http://gettingstartedwithchef.com/first-steps-with-chef.html, i.e by running curl -L https://www.opscode.com/chef/install.sh | bash as root on the host.

Should I worry about that?

The only thing I found to be changed on the host was, besides the downgrade, was the file /home/user/install.sh, which I believe is the script that made the install of chef.

Am I right?

— Reply to this email directly or view it on GitHub https://github.com/matschaffer/knife-solo/issues/425.

-Mat

about.me/matschaffer

janskarvall commented 9 years ago

I have:

$ dpkg -l | grep chef
ii  chefdk                                                      0.4.0-1                                             amd64        The full stack of chefdk
$ chef -v
Chef Development Kit Version: 0.4.0
$ chef-solo -v 
Chef: 12.1.0.rc.0
$ chef-apply -v
Chef: 12.1.0.rc.0
$ chef-zero -v
4.0
$ chef-client -v
Chef: 12.1.0.rc.0

Maybe my problem is that I did not configured to use the ruby embedded in chefdk, as I already had ruby installed before trying out chefdk. Had a look around:

$ ls -d /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef*
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-dk-0.4.0
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/cheffish-0.9.2
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-0.18
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-aws-0.2.1
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-azure-0.1
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-fog-0.12
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-vagrant-0.8.1
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chefspec-4.2.0
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-vault-2.4.0
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-1.5.6
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-3.2.1
$ ls -d /usr/local/lib/ruby/gems/2.1.0/gems/chef*
/usr/local/lib/ruby/gems/2.1.0/gems/chef-12.1.0.rc.0
/usr/local/lib/ruby/gems/2.1.0/gems/chef-zero-4.0
$ cat ~/.bash_profile 
#eval "$(chef shell-init bash)"

I installed knife-solo with chef gem install knife-solo.

I don't know how chef and chef-zero ended up in /usr/local/lib/ruby/gems/2.1.0/gems/.

matschaffer commented 9 years ago

Me neither but I suspect that's where knife solo is picking it up. I may even be calling out to 'gem' to get that info which might be why I'm not getting the chefdk version. I'll leave this open to try to ensure that knife always gets the version in the same gem space.