On Thursday, March 8, 2012 at 8:30 PM, Bryan McLellan wrote:
On Thu, Mar 8, 2012 at 4:46 AM, Sachin Sagar Rai < "> > wrote:Following installs the ruby gems on each chef-client run.gems = %w(aws-sdk gist)gems.each do |name|r = gem_package name doversion node["dev_tools"]["#{name}_version"]action :nothingendr.run_action(:install)endHow to apply the `not_if` conditional checking for the`r.run_action(:install)` action?As I mentioned in the other email thread, this pattern is a bit of akludge to install the gem immediately so they can be used in a Chefrecipe, and the pattern is replaced with chef_gem in the next versionof Chef. If you don't need to use the gem in the Chef recipe, use thestandard pattern:gems = %w(aws-sdk gist)gems.each do |name|gem_package name doversion node["dev_tools"]["#{name}_version"]not_if "true"endendIf you do need them immediately you could use the existing kludgepattern but wrap the call to run_action in a conditional:if !system('false')r.run_action(:install)endBryan
Archive powered by MHonArc 2.6.16.