Chef 0.10.6 and chef_gem

well chef_gem didn’t exist in 0.10.6, but we haven’t upgraded yet, and
i’m running into a problem…

I want to do something like this:

gem_package “f5-icontrol” do
source "#{Chef::Config[:file_cache_path]}/f5-icontrol-10.2.0.2.gem"
end

require ‘f5-icontrol’

But I get an error… f5-icontrol cannot be included by the recipe,
because it isn’t installed yet… it isn’t installed yet because the
recipe requires… you get the idea.

Is there a chef 0.10.6 way of doing this? the docs say to do it with chef_gem.

thanks!

Heavy Water produced this cookbook to add chef_gem to versions < 0.10.12

http://community.opscode.com/cookbooks/chef_gem

alternately, you can use the old school way of doing it (compile time):

On 6 August 2012 01:32, Jesse Campbell hikeit@gmail.com wrote:

well chef_gem didn't exist in 0.10.6, but we haven't upgraded yet, and
i'm running into a problem...

I want to do something like this:

g = gem_package "f5-icontrol" do
source "#{Chef::Config[:file_cache_path]}/f5-icontrol-10.2.0.2.gem"
action :nothing
end

g.run_action(:install)

require 'f5-icontrol'

But I get an error... f5-icontrol cannot be included by the recipe,
because it isn't installed yet... it isn't installed yet because the
recipe requires... you get the idea.

Is there a chef 0.10.6 way of doing this? the docs say to do it with chef_gem.

thanks!

A couple of ways:

  1. Use chef_gem cookbook 1
  2. Use the 'trick' 2 method like so:

r = gempackage "f5-icontrol" do
source "#{Chef::Config[:file_cache_path]}/f5-icontrol-10.2.0.2.gem"
action :nothing
end

r.runaction(:install)

I would recommend using #1, as this will make your code a little more
consistent when you upgrade to the new version of Chef.

-M

On Sun, Aug 5, 2012 at 9:32 AM, Jesse Campbell hikeit@gmail.com wrote:

well chef_gem didn't exist in 0.10.6, but we haven't upgraded yet, and
i'm running into a problem...

I want to do something like this:

gem_package "f5-icontrol" do
source "#{Chef::Config[:file_cache_path]}/f5-icontrol-10.2.0.2.gem"
end

require 'f5-icontrol'

But I get an error... f5-icontrol cannot be included by the recipe,
because it isn't installed yet... it isn't installed yet because the
recipe requires... you get the idea.

Is there a chef 0.10.6 way of doing this? the docs say to do it with chef_gem.

thanks!

On 6 August 2012 01:36, AJ Christensen aj@junglist.gen.nz wrote:

Heavy Water produced this cookbook to add chef_gem to versions < 0.10.12

http://community.opscode.com/cookbooks/chef_gem

alternately, you can use the old school way of doing it (compile time):

On 6 August 2012 01:32, Jesse Campbell hikeit@gmail.com wrote:

well chef_gem didn't exist in 0.10.6, but we haven't upgraded yet, and
i'm running into a problem...

I want to do something like this:

g = gem_package "f5-icontrol" do
source "#{Chef::Config[:file_cache_path]}/f5-icontrol-10.2.0.2.gem"
action :nothing
end

g.run_action(:install)

oh, you need to refresh the gem cache before the require, too :slight_smile:

Gem.clear_paths

require 'f5-icontrol'

But I get an error... f5-icontrol cannot be included by the recipe,
because it isn't installed yet... it isn't installed yet because the
recipe requires... you get the idea.

Is there a chef 0.10.6 way of doing this? the docs say to do it with chef_gem.

thanks!

thanks! this looks perfect!
i have one other question, but it'll get a new thread.

-jesse

On Sun, Aug 5, 2012 at 9:37 AM, AJ Christensen aj@junglist.gen.nz wrote:

On 6 August 2012 01:36, AJ Christensen aj@junglist.gen.nz wrote:

Heavy Water produced this cookbook to add chef_gem to versions < 0.10.12

http://community.opscode.com/cookbooks/chef_gem

alternately, you can use the old school way of doing it (compile time):

On 6 August 2012 01:32, Jesse Campbell hikeit@gmail.com wrote:

well chef_gem didn't exist in 0.10.6, but we haven't upgraded yet, and
i'm running into a problem...

I want to do something like this:

g = gem_package "f5-icontrol" do
source "#{Chef::Config[:file_cache_path]}/f5-icontrol-10.2.0.2.gem"
action :nothing
end

g.run_action(:install)

oh, you need to refresh the gem cache before the require, too :slight_smile:

Gem.clear_paths

require 'f5-icontrol'

But I get an error... f5-icontrol cannot be included by the recipe,
because it isn't installed yet... it isn't installed yet because the
recipe requires... you get the idea.

Is there a chef 0.10.6 way of doing this? the docs say to do it with chef_gem.

thanks!