I have a custom library and want to access the current cookbook from the cookbook_collection in the run_context, but it seems to be coming back null
I have
Chef::Log.info run_context.cookbook_collection['my_cookbook']
It prints
#<Chef::CookbookVersion:0x00000004d3f578>
But if I do
Chef::Log.info run_context.cookbook_collection['my_cookbook'].root_dir
where my_cookbook is the name of the current cookbook, I get nothing printed. How can I access the root_dir of the current_cookbook from my library?
Copying down from the comment:
That is not supported and will break in some releases. Use a
cookbook_fileresource first to copy it out to known location. This might mean your library helper code needs to be become a DSL extension or custom resource instead.