Method: Chef::Provider::RemoteFile::NetworkFile#fetch
- Defined in:
- lib/chef/provider/remote_file/network_file.rb
#fetch ⇒ Object
Fetches the file on a network share, returning a Tempfile-like File handle windows only
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/chef/provider/remote_file/network_file.rb', line 41 def fetch begin tempfile = Chef::FileContentManagement::Tempfile.new(new_resource).tempfile Chef::Log.trace("#{new_resource} staging #{@source} to #{tempfile.path}") with_user_context(new_resource.remote_user, new_resource.remote_password, new_resource.remote_domain, new_resource.authentication) do ::File.open(@source, "rb") do |remote_file| while data = remote_file.read(TRANSFER_CHUNK_SIZE) tempfile.write(data) end end end ensure tempfile.close if tempfile end tempfile end |