[chef] Re: help with yum_package flush_cache optiop


Chronological Thread 
  • From: Matthew Moretti < >
  • To: " " < >
  • Subject: [chef] Re: help with yum_package flush_cache optiop
  • Date: Fri, 5 Jun 2015 13:33:39 -0400

Can you show us what you have and the error you’re getting?

The format should be something like:

# Works in all Rubies
yum_package 'some-package' do
#...
flush_cache({ :before => false, :after => false })
#...
end

# Also works in Ruby >= 1.9
yum_package 'some-package' do
#...
flush_cache({ before: false, after: false })
#...
end

Ordinarily, the parentheses on resource attributes aren’t required, but without them, in this case, the Ruby syntax parser has no way of differentiating between a hash argument and a block argument. That is, this does not work:

yum_package 'some-package' do
#...
flush_cache { :before => false, :after => false }
#...
end

# syntax error, unexpected =>, expecting '}'
#  flush_cache { :before => false, :after => false }
#                          ^

If I had to guess, perhaps this is the error you’re getting?

Matt Moretti
UMTS IT


On Thu, Jun 4, 2015 at 10:55 PM, Fouts, Chris < " target="_blank"> > wrote:

https://docs.chef.io/resource_package.html

 

Above documentation for flush_cache gives a syntax error. What is the correct syntax?

 

Chris





Archive powered by MHonArc 2.6.16.

§