Chef 12 in ChefDK


#1

Hi,

I ran into an issue [0] with ChefSpec caused by an incompatibility
between it and Chef 12. I was surprised to realized that ChefDK 0.3
bundles a number of different chef versions, including an alpha of
Chef 12. I tried forcing the removal of 12.0.0.alpha.2, but that broke
/usr/bin/chef. For now I switched away from ChefDK to get a working
ChefSpec and Chef combination.

Can anyone explain why ChefDK is using a prerelease version of chef
that isn’t compatible with other gems it bundles?

[0] https://github.com/sethvargo/chefspec/issues/518


Brian Pitts
Web Operations Engineer
Lonely Planet


#2

On Wednesday, November 5, 2014 at 8:00 PM, Brian Pitts wrote:

Hi,

I ran into an issue [0] with ChefSpec caused by an incompatibility
between it and Chef 12. I was surprised to realized that ChefDK 0.3
bundles a number of different chef versions, including an alpha of
Chef 12. I tried forcing the removal of 12.0.0.alpha.2, but that broke
/usr/bin/chef. For now I switched away from ChefDK to get a working
ChefSpec and Chef combination.

Can anyone explain why ChefDK is using a prerelease version of chef
that isn’t compatible with other gems it bundles?

ChefDK has a number of applications it ships that all have different dependencies. Though you saw this problem with the chef gem, it could also happen with RSpec, since the various apps in ChefDK are on different versions of RSpec. Furthermore, it’s completely possible for you to install gems which might conflict with the applications packaged in ChefDK (using chef gem install). For this reason, most executables in ChefDK are generated with the appbundler tool, which locks all dependencies to known working versions.

ChefSpec is a tricky case because it’s more or less a plugin for RSpec, but we’re not installing RSpec itself via the appbundler process. In the future we plan to wrap ChefSpec in a chef test command: https://github.com/opscode/chef-dk/issues/18

For now you can use bundler to lock your gem versions for RSpec/ChefSpec to a compatible set. Initializing your shell via chef shell-init makes this a lot easier.

[0] https://github.com/sethvargo/chefspec/issues/518


Brian Pitts
Web Operations Engineer
Lonely Planet


Daniel DeLeo