Is it possible to specify a gem to use within a recipe

I’m using the Omnibus client (0.10.8) and can’t use the route53 cookbook as the client uses an older version of fog (0.8.2) which throws “aws is not a recognized dns provider”. The fix is to use a newer version of fog (currently at 1.3.1) but how can I reference it in a recipe? Is this the correct approach?

You could take a look at the f5 cookbook to see if it gives any ideas,
if helpful... they have a provided gem in the package.

https://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/1086471/Automating-Web-App-Deployments-with-Opscode-Chef-and-iControl.aspx

On Wed, Apr 11, 2012 at 11:49, Clif Smith clif@texicans.us wrote:

I'm using the Omnibus client (0.10.8) and can't use the route53 cookbook as the client uses an older version of fog (0.8.2) which throws "aws is not a recognized dns provider". The fix is to use a newer version of fog (currently at 1.3.1) but how can I reference it in a recipe? Is this the correct approach?

On Wed, Apr 11, 2012 at 11:49 AM, Clif Smith clif@texicans.us wrote:

I'm using the Omnibus client (0.10.8) and can't use the route53 cookbook as the client uses an older version of fog (0.8.2) which throws "aws is not a recognized dns provider". The fix is to use a newer version of fog (currently at 1.3.1) but how can I reference it in a recipe? Is this the correct approach?

The gem_package resource will take a 'version' argument:
http://wiki.opscode.com/display/chef/Resources#Resources-Package

You can read about using a gem in a recipe here:

This will be easier in Chef 0.10.10: http://tickets.opscode.com/browse/CHEF-2879

Bryan

Thanks for the reply, but I don't need to install the gem, it already is. The problem with the route53 cookbook is it requires a newer version of fog than what's bundled in the Omnibus chef-client. So, while I have fog v1.3.1 installed on my system, the route53 recipe fails as it uses the bundled fog v0.8.2. How can I force the route53 recipe to use the non-bundled fog gem?

On Apr 11, 2012, at 12:12 PM, Bryan McLellan wrote:

On Wed, Apr 11, 2012 at 11:49 AM, Clif Smith clif@texicans.us wrote:

I'm using the Omnibus client (0.10.8) and can't use the route53 cookbook as the client uses an older version of fog (0.8.2) which throws "aws is not a recognized dns provider". The fix is to use a newer version of fog (currently at 1.3.1) but how can I reference it in a recipe? Is this the correct approach?

The gem_package resource will take a 'version' argument:
http://wiki.opscode.com/display/chef/Resources#Resources-Package

You can read about using a gem in a recipe here:
Cool Chef Tricks: Install and Use RubyGems in a Chef Run - Chef Blog | Chef

This will be easier in Chef 0.10.10: http://tickets.opscode.com/browse/CHEF-2879

Bryan

On Wed, Apr 11, 2012 at 3:21 PM, Clif Smith clif@texicans.us wrote:

Thanks for the reply, but I don't need to install the gem, it already is. The problem with the route53 cookbook is it requires a newer version of fog than what's bundled in the Omnibus chef-client. So, while I have fog v1.3.1 installed on my system, the route53 recipe fails as it uses the bundled fog v0.8.2. How can I force the route53 recipe to use the non-bundled fog gem?

Except that is a different version of Rubygems than you're running
Chef under. I would install the version of Fog that you need in
Omnibus. That's where all gems that you use in a recipe should live.

I guess you could prepend your other gem directories onto $LOAD_PATH,
but that's scary. But I'm scared by the world that is Ruby libraries +
Rubygems.

Bryan