Is there any way to test that a given cookbook_file exists in a chef recipe? I would like to do something like the following:
cookbook_file "/etc/cron.d/#{service}" do
source "etc/cron.d/#{service}"
owner "root"
group "root"
mode "0644"
end
and have it not fail if the file "etc/cron.d/{service_name}" does not exist, since I may have many services running on a machine, but only some of them have associated cron jobs.
I don't want to have a big list of services that take cron jobs like
['service_1', 'service_2', ...],
since that seems fairly brittle. Ideally, I'd like to have a directory that contains cron jobs for the services that need them, and have the recipe not fail if these files are not present. Is what I'm looking for possible?