How to get a full path of the running cookbook in the RightScale chef recipe?

那年仲夏 提交于 2019-12-10 15:53:32

问题


From inside my currently executing cookbook recipe I'd like to get access to it's "current" location on my executing machine.

I need this to get access to it's cached directory structure.

I have a feeling it's located somewhere inside "node[]" but I can't find any documentation about its structure at all.

Any advise?

Thanks


回答1:


Just found the solution by inspecting the "run_context" instance:

ruby_block "reload_client_config" do
  block do
    puts "HERE!!!!!  -> " + run_context.cookbook_collection[cookbook_name].root_dir
  end
  action :create
end

This came to me after seeing this thread - Get deployed cookbook version



来源:https://stackoverflow.com/questions/14075847/how-to-get-a-full-path-of-the-running-cookbook-in-the-rightscale-chef-recipe

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