问题
I have two recipes in different cookbooks. I need the first recipe to be completely finished before the second one starts execution, as it places some files that the second will need. I put the first one before the second in the run list, but it seems as if they get executed in parallel.
How can I trigger the second recipe's execution when the first is done? (Note that they are in different cookbooks.)
回答1:
Can you post a snippet of the code. My guess is that you're making use of LWRP (possibly inbuilt) and they are all getting executed towards the end of the run. Does this sound familiar?
Code like:
cookbook_file node['.NET']['FilePath'] do
source node['.NET']['FileName']
action :create
end
could get converted to:
configFile = cookbook_file node['.NET']['FilePath'] do
source node['.NET']['FileName']
action :nothing
end
configFile.run_action(:create)
which means the execution is forced at that part of the code (ie when we are resolving the recipe)
来源:https://stackoverflow.com/questions/12921078/executing-chef-recipe-only-after-another-recipe-is-finished