- From: Bryan McLellan <
>
- To:
- Subject: [chef] Re: Re: Re: How to do conditional checks for gem installation?
- Date: Thu, 8 Mar 2012 10:45:53 -0500
On Thu, Mar 8, 2012 at 10:03 AM, Sachin Sagar Rai
<
>
wrote:
>
Yup, I want to use the gem immediately as well.
The r.run_action(:install) call is a hack that utilizes the fact that
recipes are in Ruby to call the install method on a resource that you
have just created manually without waiting for the phase of the Chef
run that would do so as part of process. This isn't part of the Chef
DSL and is regular Ruby. gem_package is part of the Chef DSL, but we
can place that object in 'r' and then access its methods through 'r'.
Thus I was suggesting using more ruby to control if that call is made
or not.
gems = %w(aws-sdk gist)
gems.each do |name|
r = gem_package name do
version node["dev_tools"]["#{name}_version"]
end
if !system('false')
r.run_action(:install)
end
end
Bryan
Archive powered by MHonArc 2.6.16.