Executing chef recipe only after another recipe is finished

倾然丶 夕夏残阳落幕 提交于 2019-12-10 12:26:48

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!