Home Ask Login Register

Developers Planet

Your answer is one click away!

post2626 February 2016

How to resolve a mixlib-shellout gem version conflict?

I am trying use to Kitchen/Chef to deploy. I am actually not sure if I've touched Kitchen yet.

My understanding is gem list lists all the gems in the repository, and a project fetches any gems it wants from this repository.

After I ran gem install bundler and gem install berkshelf I have a mixlib-shellout (2.2.6) shown by gem list | grep shellout.

Then I ran bundle install and based on my Gemfile, "mixlib-shellout (1.6.1)" is installed. Then I have "mixlib-shellout (2.2.6, 1.6.1)" shown by gem list | grep shellout.

From Gemfile.lock, I believe 1.6.1 is the version wanted. Then I ran berks install, an exception was thrown, which was:

Unable to activate chef-11.18.12, because mixlib-shellout-2.2.6 conflicts with mixlib-shellout (~> 1.4) - 11.18.12 -  (Gem::LoadError)

I don't understand why it tries to fetch 2.2.6 instead of 1.6.1.

My Gemfile

source 'https://rubygems.org'

group :development do
  gem 'berkshelf', '~> 4.0'
  gem 'berkshelf-api-client', '~> 2.0'

  gem 'thor'

  gem 'chef', '~> 11.16'
  gem 'test-kitchen', '~> 1.2'
  gem 'kitchen-vagrant', '>= 0.16'
  gem 'serverspec'
  gem 'infrataster'
  gem 'busser'
  gem 'busser-serverspec'

  gem 'chefspec', '~>4'

  gem 'rubocop'
  gem 'foodcritic'
end

gem 'chef-vault', '~> 2.2'

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    addressable (2.3.8)
    ast (2.2.0)
    berkshelf (4.1.0)
      addressable (~> 2.3.4)
      berkshelf-api-client (~> 2.0)
      buff-config (~> 1.0)
      buff-extensions (~> 1.0)
      buff-shell_out (~> 0.1)
      celluloid (= 0.16.0)
      celluloid-io (~> 0.16.1)
      cleanroom (~> 1.0)
      faraday (~> 0.9.0)
      httpclient (~> 2.6.0)
      minitar (~> 0.5.4)
      octokit (~> 4.0)
      retryable (        

Answers


lamont February 2016

You do not want to be bundling chef-11.18.12 with test-kitchen and berkshelf. You don't need to bundle chef with those tools, and you definitely will run into issues trying to bundle chef-11 with them.

The problem with creating a Gemfile with all of your cli tools in them is that those tools never activate the entire set of gems all at once. So test-kitchen does not depend on chef, and berkshelf only recently started pulling in chef-config as a library. When you try to create a bundle you are stating that every gem must be capable of being loaded into the same ruby process with every other gem. Even for the latest set of cli tools this is something which will frequently break. If you add in chef-11.18.12 then you are picking a gem with a frozen set of gem requirements from April of last year (about 9 months ago), and its highly likely that the latest test-kitchen and berkshelf versions will pull in versions of mixlib-shellout that are incompatible with that version of chef. It gets worse because we made breaking changes to mixlib-shellout and chef-11 is forever pinned on an old branch of mixlib-shellout that is not getting updates, while test-kitchen and berkshelf have moved on.

This is why ChefDK exists which is to give a consistent set of command line tools, in something that looks superficially like a bundle, but which is not a bundle. If test-kitchen or berkshelf don't load chef into memory simultaneously, then it is fine to include different versions of those gems which may 'conflict' in their use of mixlib-shellout but will load into different ruby process just fine. Since they never all try to load into the same ruby process the 'conflict' over mixlib-shellout never becomes a real one.

Also, we do try to take a bit of care that they all load together correctly and we don't wind up with multiple versions of mixlib-shellout in the ChefDK, but sometimes this is difficult to avoid.

What you are probably trying to do is b

Post Status

Asked in February 2016
Viewed 3,339 times
Voted 10
Answered 1 times

Search




Leave an answer


Quote of the day: live life