[chef] Gem Sources configured with .gemrc


Chronological Thread 
  • From: Tyler Ball < >
  • To: " " < >
  • Subject: [chef] Gem Sources configured with .gemrc
  • Date: Tue, 17 Dec 2013 23:19:15 +0000
  • Accept-language: en-US

Hey everyone,

At my company we have a bunch of in-house written and maintained gems that we currently host with a prviate geminabox repo.  I can log into one of our application servers and execute 'gem install foo_gem' to install foo_gem from our private gem repo.  This works without adding a '--source' argument because I use chef to configure the gemrc config file for users (http://guides.rubygems.org/command-reference/#gem_environment).  Basically, I write out a gemrc file which contains our private gem repo as one of the sources.

This works great because I don't have to specify gem sources in our many cookbooks which install gems from our private repo.  We have 1 issue though - on a new node if I modify the gemrc file with chef it does not reload the gem configuration in that same chef run.  So a node runs chef-client for the first time, writes out a gemrc file and then tries to download 'foo_gem' which fails since it only exists in our private repo.  But if I immediately run chef-client again, it successfully downloads the gem because it loads the gemrc configuration.

From browsing around the repo, it looks like chef loads the gem configuration with a call to 'Gem.configuration' at the top of the rubygems.rb provider.  Does anyone have any suggestions as to how I can get chef to reload its configuration after it writes the gemrc file so my first chef runs succeed?

Thanks!
-Tyler

ruby -v = 1.9.3
chef -v = 11.4.4
gem -v = 1.8.23


  • [chef] Gem Sources configured with .gemrc, Tyler Ball, 12/17/2013

Archive powered by MHonArc 2.6.16.

§