[chef] Re: gem sources chicken & egg problem


Chronological Thread 
  • From: DV < >
  • To: " " < >
  • Subject: [chef] Re: gem sources chicken & egg problem
  • Date: Thu, 9 Oct 2014 13:34:44 -0700

Thanks guys, I'll test this solution out and let you know if it worked.

On Wed, Oct 8, 2014 at 3:41 PM, Jake Plimack < " target="_blank"> > wrote:
I would recommend that first off, you run your own gem mirror, as rubygems goes down all the time.  It will provide security, stability, and speed boosts.
second, make it run during the compile phase.

execute 'set-gem-repos' do
command '/usr/bin/gem sources --add https://rubygems.org/'
action :nothing
end.run_action(:run)

my solution is that every node gets the base cookbook (formerly a role) first, which a. makes hints and runs ohai. b. sets up apt/gem/etc. and then the node gets additional run_list items. Since chef executes in order, the node's environment will be prepped during this base phase for anything it might be destined for.

On Wed, Oct 8, 2014 at 4:27 PM, DV < " target="_blank"> > wrote:
Hi guys,

Thought I'd get your advice on the following:

I have chef-client run fail on the initial (only) run due to host's default gem sources not having the version of gem chef-client is trying to install. To be more specific, it's passenger gem from passenger_apache2::source cookbook here:

gem_package "passenger" do
  version node['passenger']['version']
end

The default gem sources on the host simply don't have passenger gem and/or its dependencies so of course it fails.

My goal is to make chef-client aware of an additional gem source at first run. So far I've tried the following:

execute 'add_rubygems.org_gemrepo' do
    action :run
    command '/usr/bin/gem sources --add https://rubygems.org/'
end

I see the code being executed on chef-client run, nevertheless, first chef-client run fails to find passenger gem. So there must be some caching going on that I need to override.

All further chef-client runs succeed, though.

So my question is, how can I make chef-cilent aware of additional gem sources on its very first run?

--
Best regards, Dmitriy V.




--
Best regards, Dmitriy V.



Archive powered by MHonArc 2.6.16.

§