Method: Chef::Provider::File#deploy_tempfile

Defined in:
lib/chef/provider/file.rb

#deploy_tempfileObject



304
305
306
307
308
309
310
311
312
313
314
# File 'lib/chef/provider/file.rb', line 304

def deploy_tempfile
  Tempfile.open(::File.basename(@new_resource.name)) do |tempfile|
    yield tempfile

    temp_res = Chef::Resource::CookbookFile.new(@new_resource.name)
    temp_res.path(tempfile.path)
    ac = Chef::FileAccessControl.new(temp_res, @new_resource, self)
    ac.set_all!
    FileUtils.mv(tempfile.path, @new_resource.path)
  end
end