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

Dependency #530

Closed florian-asche closed 5 years ago

florian-asche commented 6 years ago

The dependency in this repo is not set to Chef 13. It installs Chef Version 14 now. Chefdk is still using Chef 13 but after bundle install Version 14 is installed, which is not working that way.

I did add Chef 13 manually in my Gemfile but you should consider set a max Version 13...

matschaffer commented 6 years ago

I don't think we'd want to put a hard upper bound on the version. We run tests across a few different chef versions at this point https://github.com/matschaffer/knife-solo/blob/master/.travis.yml

I'd hope chef gem install knife-solo doesn't try to bump the chefdk from 13 to 14 but if it does that's probably worth bringing up with the chef folks.

florian-asche commented 6 years ago

Ok. Looks like the newest chefdk is no longer compatible.

matschaffer commented 6 years ago

Just to be sure I tried this on a xenial vagrant box. Chef stayed at version 13 the whole time.

Note that the 0.6.0 release is known to have a net-ssh incompatibility. The 0.7.0 pre-release shouldn't have this problem.

❯ vagrant ssh control
Welcome to Ubuntu 16.04.4 LTS (GNU/Linux 4.4.0-124-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.

vagrant@ubuntu-xenial:~$ wget https://packages.chef.io/files/stable/chefdk/2.4.17/ubuntu/16.04/chefdk_2.4.17-1_amd64.deb
--2018-05-17 13:10:27--  https://packages.chef.io/files/stable/chefdk/2.4.17/ubuntu/16.04/chefdk_2.4.17-1_amd64.deb
Resolving packages.chef.io (packages.chef.io)... 151.101.2.110, 151.101.66.110, 151.101.130.110, ...
Connecting to packages.chef.io (packages.chef.io)|151.101.2.110|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 104587308 (100M) [application/x-debian-package]
Saving to: ‘chefdk_2.4.17-1_amd64.deb’

chefdk_2.4.17-1_amd64.deb  100%[=====================================>]  99.74M  12.8MB/s    in 8.7s

2018-05-17 13:10:41 (11.5 MB/s) - ‘chefdk_2.4.17-1_amd64.deb’ saved [104587308/104587308]

vagrant@ubuntu-xenial:~$ sudo dpkg -i chefdk_2.4.17-1_amd64.deb
Selecting previously unselected package chefdk.
(Reading database ... 54030 files and directories currently installed.)
Preparing to unpack chefdk_2.4.17-1_amd64.deb ...
Unpacking chefdk (2.4.17-1) ...
Setting up chefdk (2.4.17-1) ...
Thank you for installing Chef Development Kit!
vagrant@ubuntu-xenial:~$ chef --version
Chef Development Kit Version: 2.4.17
chef-client version: 13.6.4
delivery version: master (73ebb72a6c42b3d2ff5370c476be800fee7e5427)
berks version: 6.3.1
kitchen version: 1.19.2
inspec version: 1.45.13
vagrant@ubuntu-xenial:~$ chef gem install knife-solo
Fetching: net-ssh-3.2.0.gem (100%)
WARNING:  You don't have /home/vagrant/.chefdk/gem/ruby/2.4.0/bin in your PATH,
      gem executables will not run.
Successfully installed net-ssh-3.2.0
Fetching: knife-solo-0.6.0.gem (100%)
Thanks for installing knife-solo!

If you run into any issues please let us know at:
  https://github.com/matschaffer/knife-solo/issues

If you are upgrading knife-solo please uninstall any old versions by
running `gem clean knife-solo` to avoid any errors.

See http://bit.ly/CHEF-3255 for more information on the knife bug
that causes this.
Successfully installed knife-solo-0.6.0
2 gems installed
vagrant@ubuntu-xenial:~$ chef --version
Chef Development Kit Version: 2.4.17
chef-client version: 13.6.4
delivery version: master (73ebb72a6c42b3d2ff5370c476be800fee7e5427)
berks version: 6.3.1
kitchen version: 1.19.2
inspec version: 1.45.13
vagrant@ubuntu-xenial:~$ chef gem install knife-solo --pre
Fetching: knife-solo-0.7.0.pre3.gem (100%)
WARNING:  You don't have /home/vagrant/.chefdk/gem/ruby/2.4.0/bin in your PATH,
      gem executables will not run.
Thanks for installing knife-solo!

If you run into any issues please let us know at:
  https://github.com/matschaffer/knife-solo/issues

If you are upgrading knife-solo please uninstall any old versions by
running `gem clean knife-solo` to avoid any errors.

See http://bit.ly/CHEF-3255 for more information on the knife bug
that causes this.
Successfully installed knife-solo-0.7.0.pre3
1 gem installed
vagrant@ubuntu-xenial:~$ chef --version
Chef Development Kit Version: 2.4.17
chef-client version: 13.6.4
delivery version: master (73ebb72a6c42b3d2ff5370c476be800fee7e5427)
berks version: 6.3.1
kitchen version: 1.19.2
inspec version: 1.45.13
florian-asche commented 6 years ago

Hi,

the problem occur with the new version: chefdk_2.5.3-1_amd64.deb. The Problem does not occur with version chefdk_2.4.17-1_amd64.deb.

And i did not install it with "gem install" i added your repository to my "Gemfile" and used bundle because of the net-ssh incompatibility.

matschaffer commented 6 years ago

If it's in a gemfile why is chefdk a factor? Can you send the file and bundle command you're using?

florian-asche commented 6 years ago

I cannot use the old chef-solo version because of the problems with net-ssh incompatibility. I added a Gemfile with content:

###########
# Gemfile #
###########

source 'https://rubygems.org'

# knife-solo
gem 'knife-solo',
    github: 'florian-asche/knife-solo',
    branch: 'master',
    submodules: true

gem 'berkshelf', '6.3.1'
gem 'rake', '12.3.1'

gem 'rubocop'
gem 'foodcritic'

That is working great with version 2.4.17. But with Version 2.5.3-1 he installs chef 14 on execution "bundle install". And then chef, berks is not working anymore.

I can add a POC in some days, need to setup a system for that, currently the time is the missing fact.

matschaffer commented 6 years ago

Can you send how you're running bundle and Berks as well? I'm still curious if/how you're hitting the chefdk gem space.

On Mon, May 21, 2018 at 8:58 Florian Asche notifications@github.com wrote:

I cannot use the old chef-solo version because of the problems with net-ssh incompatibility. I added a Gemfile with content:

###########

Gemfile

###########

source 'https://rubygems.org'

knife-solo

gem 'knife-solo', github: 'florian-asche/knife-solo', branch: 'master', submodules: true

gem 'berkshelf', '6.3.1' gem 'rake', '12.3.1'

gem 'rubocop' gem 'foodcritic'

That is working great with version 2.4.17. But with Version 2.5.3-1 he installs chef 14 on execution "bundle install". And then chef, berks is not working anymore.

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/matschaffer/knife-solo/issues/530#issuecomment-390522738, or mute the thread https://github.com/notifications/unsubscribe-auth/AAACsm07dGJqX7kzPmL0BTiRNd3FbWPgks5t0gM-gaJpZM4Tzzj9 .

--

-Mat

matschaffer.com

florian-asche commented 6 years ago

:/ i did reinstall my notebook now i dont get it working anymore... But good thing for making a POC.

florian@dexter:~/Schreibtisch/sicherung_sprung_chef_git/install$ sudo dpkg -i chefdk_2.4.17-1_amd64.deb
[sudo] Passwort für florian: 
Vormals nicht ausgewähltes Paket chefdk wird gewählt.
(Lese Datenbank ... 190554 Dateien und Verzeichnisse sind derzeit installiert.)
Vorbereitung zum Entpacken von chefdk_2.4.17-1_amd64.deb ...
Entpacken von chefdk (2.4.17-1) ...
chefdk (2.4.17-1) wird eingerichtet ...
Thank you for installing Chef Development Kit!
florian@dexter:~/Schreibtisch/sicherung_sprung_chef_git/install$ which chef
/usr/bin/chef
florian@dexter:~/Schreibtisch/sicherung_sprung_chef_git/install$ chefdk_2.4.17-1_amd64.deb^C
florian@dexter:~/Schreibtisch/sicherung_sprung_chef_git/install$ chef gem install knife-solo
Fetching: net-ssh-3.2.0.gem (100%)
WARNING:  You don't have /home/florian/.chefdk/gem/ruby/2.4.0/bin in your PATH,
      gem executables will not run.
Successfully installed net-ssh-3.2.0
Fetching: knife-solo-0.6.0.gem (100%)
Thanks for installing knife-solo!

If you run into any issues please let us know at:
  https://github.com/matschaffer/knife-solo/issues

If you are upgrading knife-solo please uninstall any old versions by
running `gem clean knife-solo` to avoid any errors.

See http://bit.ly/CHEF-3255 for more information on the knife bug
that causes this.
Successfully installed knife-solo-0.6.0
2 gems installed
florian@dexter:~/Schreibtisch/sicherung_sprung_chef_git/install$ knife solo cook
/opt/chefdk/embedded/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:2290:in `raise_if_conflicts': Unable to activate knife-solo-0.6.0, because net-ssh-4.1.0 conflicts with net-ssh (< 4.0, >= 2.7) (Gem::ConflictError)
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.4.0/rubygems/specification.rb:1410:in `activate'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.4.0/rubygems.rb:220:in `rescue in try_activate'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.4.0/rubygems.rb:213:in `try_activate'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:126:in `rescue in require'
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:40:in `require'
    from /home/florian/.chefdk/gem/ruby/2.4.0/gems/knife-solo-0.6.0/lib/chef/knife/wash_up.rb:1:in `<top (required)>'
    from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/knife/core/subcommand_loader.rb:85:in `load'
    from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/knife/core/subcommand_loader.rb:85:in `block in load_commands'
    from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/knife/core/subcommand_loader.rb:85:in `each'
    from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/knife/core/subcommand_loader.rb:85:in `load_commands'
    from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/knife/core/subcommand_loader.rb:95:in `load_command'
    from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/knife/core/subcommand_loader.rb:109:in `command_class_from'
    from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/knife.rb:153:in `subcommand_class_from'
    from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/knife.rb:214:in `run'
    from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/lib/chef/application/knife.rb:156:in `run'
    from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/chef-13.6.4/bin/knife:25:in `<top (required)>'
    from /usr/bin/knife:255:in `load'
    from /usr/bin/knife:255:in `<main>'
florian-asche commented 6 years ago
florian@dexter:~/Schreibtisch/sicherung_sprung_chef_git/intern$ PATH=${HOME}/.chefdk/gem/ruby/2.4.0/bin:/opt/chefdk/bin:/opt/chefdk/embedded/bin:$PATH
florian@dexter:~/Schreibtisch/sicherung_sprung_chef_git/intern$ GEM_HOME=${HOME}/.chefdk/gem/ruby/2.4.0
florian@dexter:~/Schreibtisch/sicherung_sprung_chef_git/intern$ GEM_PATH=/opt/chefdk/embedded/lib/ruby/gems/2.4.0:$GEM_HOME

Gemfile:

###########
# Gemfile #
###########

source 'https://rubygems.org'

# knife-solo
gem 'knife-solo',
  :github => 'matschaffer/knife-solo',
  :branch => 'master',
  :submodules => true

#gem 'knife-zero'

gem 'berkshelf', '6.3.1'
gem 'rake', '12.3.1'

gem 'rubocop'
gem 'foodcritic'
florian@dexter:~/Schreibtisch/sicherung_sprung_chef_git/intern$ bundle
The git source `git://github.com/matschaffer/knife-solo.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
Warning: the running version of Bundler (1.15.4) is older than the version that created the lockfile (1.16.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
Fetching git://github.com/matschaffer/knife-solo.git
Submodul 'lib/knife-solo/resources/patch_cookbooks/chef-solo-search' (https://github.com/edelight/chef-solo-search.git) für Pfad 'lib/knife-solo/resources/patch_cookbooks/chef-solo-search' in die Konfiguration eingetragen.
Klone nach '/home/florian/.bundle/ruby/2.4.0/knife-solo-0026879782b4/lib/knife-solo/resources/patch_cookbooks/chef-solo-search' ...
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Fetching rake 12.3.1

Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle install --path vendor/bundle

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

  Password: 
Installing rake 12.3.1
Fetching public_suffix 3.0.2
Installing public_suffix 3.0.2
Fetching ast 2.4.0
Installing ast 2.4.0
Fetching backports 3.11.3
Installing backports 3.11.3
Using buff-extensions 2.0.0
Fetching hashie 3.5.7
Installing hashie 3.5.7
Using bundler 1.15.4
Using fuzzyurl 0.9.0
Using tomlrb 1.2.6
Using mixlib-shellout 2.3.2
Using libyajl2 1.2.0
Using mixlib-log 1.7.1
Fetching rack 2.0.5
Installing rack 2.0.5
Using uuidtools 2.1.5
Using diff-lcs 1.3
Using erubis 2.7.0
Using highline 1.7.10
Using iniparse 1.4.4
Using iso8601 0.9.1
Using mixlib-authentication 1.4.2
Using mixlib-cli 1.7.0
Fetching net-ssh 4.2.0
Installing net-ssh 4.2.0
Fetching ffi 1.9.23
Installing ffi 1.9.23 with native extensions
Using ipaddress 0.8.3
Fetching plist 3.4.0
Installing plist 3.4.0
Using systemu 2.6.5
Using wmi-lite 1.0.0
Using proxifier 1.0.3
Fetching rspec-support 3.7.1
Installing rspec-support 3.7.1
Using builder 3.2.3
Fetching multi_json 1.13.1
Installing multi_json 1.13.1
Using net-telnet 0.1.1
Using sfl 2.3
Using syslog-logger 1.6.8
Using cleanroom 1.0.0
Using concurrent-ruby 1.0.5
Using multipart-post 2.0.0
Using httpclient 2.8.3
Fetching minitar 0.6.1
Installing minitar 0.6.1
Using retryable 2.0.4
Using buff-ignore 1.2.0
Using buff-ruby_engine 1.0.0
Using hitimes 1.2.6
Fetching nio4r 2.3.1
Installing nio4r 2.3.1 with native extensions
Fetching json 2.1.0
Installing json 2.1.0 with native extensions
Using semverse 2.0.0
Fetching molinillo 0.6.5
Installing molinillo 0.6.5
Using thor 0.19.1
Fetching cucumber-tag_expressions 1.1.1
Installing cucumber-tag_expressions 1.1.1
Using gherkin 5.0.0
Using mini_portile2 2.3.0
Using rufus-lru 1.1.0
Using polyglot 0.3.5
Fetching parallel 1.12.1
Installing parallel 1.12.1
Using powerpack 0.1.1
Fetching rainbow 3.0.0
Installing rainbow 3.0.0
Using ruby-progressbar 1.9.0
Fetching unicode-display_width 1.3.2
Installing unicode-display_width 1.3.2
Using addressable 2.5.2
Fetching parser 2.5.1.0
Installing parser 2.5.1.0
Using varia_model 0.6.0
Fetching mixlib-config 2.2.6
Installing mixlib-config 2.2.6
Using ffi-yajl 2.3.1
Fetching mixlib-archive 0.4.5
Installing mixlib-archive 0.4.5
Using net-sftp 2.1.2
Fetching net-ssh-gateway 2.0.0
Installing net-ssh-gateway 2.0.0
Using net-scp 1.2.1
Fetching rspec-core 3.7.1
Installing rspec-core 3.7.1
Using rspec-expectations 3.7.0
Using rspec-mocks 3.7.0
Fetching faraday 0.15.0
Installing faraday 0.15.0
Using buff-shell_out 1.1.0
Using timers 4.0.4
Using solve 4.0.0
Using cucumber-core 3.1.0
Fetching nokogiri 1.8.2
Installing nokogiri 1.8.2 with native extensions
Fetching treetop 1.6.10
Installing treetop 1.6.10
Fetching rubocop 0.55.0
Installing rubocop 0.55.0
Using buff-config 2.0.0
Fetching chef-config 13.8.5
Installing chef-config 13.8.5
Using chef-zero 13.1.0
Using net-ssh-multi 1.2.1
Fetching specinfra 2.73.3
Installing specinfra 2.73.3
Using rspec_junit_formatter 0.2.3
Using rspec-its 1.2.0
Using rspec 3.7.0
Using sawyer 0.8.1
Using celluloid 0.16.0
Fetching foodcritic 13.1.1
Installing foodcritic 13.1.1
Fetching ohai 13.9.0
Installing ohai 13.9.0
Using serverspec 2.41.3
Fetching octokit 4.8.0
Installing octokit 4.8.0
Using celluloid-io 0.16.2
Fetching chef 13.8.5
Installing chef 13.8.5
Using ridley 5.1.1
Using knife-solo 0.7.0.pre3 from git://github.com/matschaffer/knife-solo.git (at master@0026879)
Using berkshelf 6.3.1
Bundle complete! 5 Gemfile dependencies, 97 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Post-install message from minitar:
The `minitar` executable is no longer bundled with `minitar`. If you are
expecting this executable, make sure you also install `minitar-cli`.
Post-install message from knife-solo:
Thanks for installing knife-solo!

If you run into any issues please let us know at:
  https://github.com/matschaffer/knife-solo/issues

If you are upgrading knife-solo please uninstall any old versions by
running `gem clean knife-solo` to avoid any errors.

See http://bit.ly/CHEF-3255 for more information on the knife bug
florian@dexter:~/Schreibtisch/sicherung_sprung_chef_git/intern$ bundle exec knife solo cook
/opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/bundler-1.15.4/lib/bundler/rubygems_integration.rb:377:in `block (2 levels) in replace_gem': activesupport is not part of the bundle. Add it to your Gemfile. (Gem::LoadError)
    from /opt/chefdk/bin/knife:7:in `<main>'
florian-asche commented 6 years ago

After installing chef gem:

florian@dexter:~/Schreibtisch/sicherung_sprung_chef_git/intern$ chef gem install chef
Fetching: mixlib-config-2.2.13.gem (100%)
Successfully installed mixlib-config-2.2.13
Fetching: chef-config-14.3.37.gem (100%)
Successfully installed chef-config-14.3.37
Fetching: mixlib-log-2.0.4.gem (100%)
Successfully installed mixlib-log-2.0.4
Fetching: mixlib-authentication-2.1.1.gem (100%)
Successfully installed mixlib-authentication-2.1.1
Fetching: ffi-1.9.25.gem (100%)
Building native extensions.  This could take a while...
Successfully installed ffi-1.9.25
Fetching: ohai-14.3.0.gem (100%)
Successfully installed ohai-14.3.0
Fetching: chef-zero-14.0.6.gem (100%)
Successfully installed chef-zero-14.0.6
Fetching: chef-14.3.37.gem (100%)
Successfully installed chef-14.3.37
8 gems installed
florian@dexter:~/Schreibtisch/sicherung_sprung_chef_git/intern$ bundle exec knife --version
Chef: 13.8.5
matschaffer commented 6 years ago

So you shouldn't have to use bundler to get around the net-ssh incompatibility. chef gem install knife-solo --pre should get you the 0.7.0 pre-release (see https://github.com/matschaffer/knife-solo/issues/530#issuecomment-389861519 for my test output which uses this command)

I'd recommend going that route if possible. Getting bundle in the mix will start locking up gem versions that you might not intend to.

florian-asche commented 5 years ago

Sorry for the really late response. Yes, that's correct. With --pre its working fine, also up to the latest chefdk version. My Installation now is the following:

There is no Gemfile needed!

Don't know it I still need to install chef after. But whatever, it's working great that way. Will test it next time I have to install it if chef is still needed.

You could help others if you write this in the README.

matschaffer commented 5 years ago

Not quite sure what we'd add to the readme.

The --pre should no longer be required since 0.7.0 has been released. I suspect you don't need the chef gem install chef at this stage either.

Reopen and let me know if you find otherwise.

Thanks for following up!