[chef] Re: Searching files/ to see if file exists


Chronological Thread 
  • From: Ranjib Dey < >
  • To:
  • Cc: " " < >
  • Subject: [chef] Re: Searching files/ to see if file exists
  • Date: Fri, 2 May 2014 09:32:40 -0700

you can do this with raw ruby code inside recipe:

if File.exists?('/path/to/file')
  ... add some resource
end

note. this is compile time check, so it will be false if the file is being created as part of the chef run. use ruby_block or custom lwrp for run time checks



On Fri, May 2, 2014 at 9:20 AM, Julio Lajara < " target="_blank"> > wrote:
Hi all, I need to determine if a file is included/exists in the files/* subdir under any appropriate folder for the current node, is there any way I can do this? I looked through the chef code and see theres a get_filename method as part of the cookbook code, is this usable from within cookbooks and if so can someone point to an example of how it would be used?

Thanks,




Archive powered by MHonArc 2.6.16.

§