The contents of this message, together with any attachments, are intended only for the use of the individual or entity to which they are addressed and may contain information that is legally privileged, confidential and exempt from disclosure. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this message, or any attachment, is strictly prohibited. If you have received this message in error, please notify the original sender or contact Practice Fusion at 415.346.7700 ext 4 immediately by telephone or by return E-mail and delete this message, along with any attachments, from your computer. Thank youYou can try putting it inside a ruby_block to delay running it until converge time:
file '/tmp/foo' do
end
ruby_block 'Call_helper' do
block do
::Chef::Recipe.send(:include, Helpers)
func()
end
end
HTH
From: Douglas Garstang [mailto: " target="_blank"> ]
Sent: Friday, August 28, 2015 1:27 PM
To: " target="_blank">
Subject: [chef] Helper and Resource Order
I have a default recipe with this:
file '/tmp/foo' do
end
::Chef::Recipe.send(:include, Helpers)
func()
and a helper function in libaries/ with this:
module Helpers
def func()
Chef::Log.info("I am here")
end
endMy chef run in vagrant shows this:
==> node1: [2015-08-28T20:24:53+00:00] INFO: I am here
==> node1: [2015-08-28T20:24:53+00:00] INFO: file[/tmp/foo] created file /tmp/fooObviously, the helper function func() is being called and executed before the file resource, even though the order dictates the file resource should run first. How can I ensure a specific order?
Thanks,
Douglas
Archive powered by MHonArc 2.6.16.