class Chef::Provider::CookbookFile::Content

Private Instance Methods

file_for_provider() click to toggle source
# File lib/chef/provider/cookbook_file/content.rb, line 29
def file_for_provider
  cookbook = run_context.cookbook_collection[resource_cookbook]
  file_cache_location = cookbook.preferred_filename_on_disk_location(run_context.node, :files, @new_resource.source)
  if file_cache_location.nil?
    nil
  else
    tempfile = Chef::FileContentManagement::Tempfile.new(@new_resource).tempfile
    tempfile.close
    logger.trace("#{@new_resource} staging #{file_cache_location} to #{tempfile.path}")
    FileUtils.cp(file_cache_location, tempfile.path)
    tempfile
  end
end
resource_cookbook() click to toggle source
# File lib/chef/provider/cookbook_file/content.rb, line 43
def resource_cookbook
  @new_resource.cookbook || @new_resource.cookbook_name
end