Chef: Why Are Gem Conflicts So Hard?

This blog is one of a series of blogs on the challenges of learning Chef, ops, and the technical world of IT all in one motion. Jeff Carapetyan is an Ops consultant concentrating on basic Chef work, and is sometimes available for contracts in the Austin area.

Caution Regarding Dated Material:

Some of the issues related below are being, or have been addressed by Chef. As a result, some conclusions reached here may no longer be relevant by the time you read this blog.

Fun fact

I just wanted to say that the concept of RubyGems is different than it's real world application from my experience. If you are an experienced RubyGems person you may disagree with me, but that is only because you have likely forgotten how annoying some small things are to a newbie. For me, it represented a delay of almost two weeks to get started

When I started off with installing Chef, the tutorial that I foung pointed me to using RubyGems to install all of the packages used for Chef. At first glance it even seemed like a good idea. It would not only pull down the essential pieces of software, it would find and add dependencies that were missing. As a relative newbie to using package manager's I just assumed that it was going to be all easy-street.

However, after getting errors like "unitialized constant blahblah", and "gem conflicts with nokogiri 3.2", and "gem blah_blah-1.9.2 is required, please update from blah_blah-1.9.2" I was a little frustrated. Here I was just trying to work with Chef, and I was being held up by my lack of knowledge in an installer piece.

 I will fully admit that once I understood Rubygems better it became a much easier thing to understand over time, and the use of the Omnibus Chef renders the installation issue moot. The ecosystem of Chef is built around a lot of plugins built as rubygems. Therefore, I will just give a proper warning.

  • Use Omnibus to install Chef and make your life easier
  • Realize that you are going to have to use RubyGems, so get good at troubleshooting logs
  • Be prepared to look at stack Overflow to resolve the issues

Even the Workarounds Can Have the Problem

Early versions of Chef-DK may provide a perfect example of how even the fixes to the problem can themselves go awry.

I recently installed the Chef-DK, overjoyed that my gem problems would be behind me, and I could finally get the latest testing gems all installed in one fell swoop without worrying about gem installation issues.

But then, when I ran the examples, I failed on a gem error! Dang. Foiled again. After a few days trying to get someone on the IRC channel to respond, it turned out to be an easy problem. One of my previously installed gems was fighting with one of my Chef-DK gems. Great. Gotta get better at recognizing this stuff on my own... Now, may I have my days back?