def content_from_cookbook_file(chef_run, cookbook_file)
      cookbook_name = cookbook_file.cookbook || cookbook_file.cookbook_name
      cookbook = cookbook_collection(chef_run.node)[cookbook_name]
      File.read(cookbook.preferred_filename_on_disk_location(chef_run.node, :files, cookbook_file.source))
    end
def content_from_cookbook_file(chef_run, cookbook_file)
      cookbook_name = cookbook_file.cookbook || cookbook_file.cookbook_name
      cookbook = cookbook_collection(chef_run.node)[cookbook_name]
      File.read(cookbook.preferred_filename_on_disk_location(chef_run.node, :files, cookbook_file.source))
    end
Get the contents of a cookbook file using Chef.

 @param [Chef::RunContext] chef_run
   the run context for the node
 @param [Chef::Provider::CookbookFile] cookbook_file
   the file resource