- From: Lamont Granquist <
>
- To:
- Subject: [chef] Re: Include recipe if file exists.
- Date: Thu, 08 Oct 2015 15:21:41 -0700
Similarly, you probably want to package your recipe as an LWRP and then
you can:
unless File::exist?("/etc/foo/bar")
foo "bar" do
action :run
end
end
Or use a not_if, or just bake the File.exist? check into the LWRP.
Since you mention you've had compile/converge issues its probably better
to bake the File.exist? check into the idempotency check of an LWRP and
then you *always* call the LWRP and the provider code simply does
"return if File.exist?("/etc/foo/bar")" and then the calling code is not
responsible for that check and just calls the LWRP.
On 10/08/2015 09:17 AM, Doug Garstang wrote:
All,
Trying to do a conditional include_recipe based on a file existing.
Doesn't work due to compile/converge stage stuff.
A workaround was suggested here by the folks that should know:
https://tickets.opscode.com/browse/CHEF-5342
However, it doesn't work, just as someone else responded to the ticket
with. They did not get a reply.
So, just to be clear, as suggested, this does not work:
unless ::File.exists?("/etc/foo/bar")
include_recipe "foo::bar"
end
Doug
Archive powered by MHonArc 2.6.16.