summaryrefslogtreecommitdiff
path: root/lib/chef/provider/remote_file/local_file.rb
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-05-20 07:55:44 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2015-05-21 10:13:07 -0500
commit8d969503cdb5805807aeec8d06629116c28e5877 (patch)
tree87d429c955787ec7f38c63081c624ef4b48ed3ab /lib/chef/provider/remote_file/local_file.rb
parent6ba819dd88383a9ad7ef7af5b013cbf6a4da2c84 (diff)
downloadchef-8d969503cdb5805807aeec8d06629116c28e5877.tar.gz
Update specs for remote local file + spaces
Diffstat (limited to 'lib/chef/provider/remote_file/local_file.rb')
-rw-r--r--lib/chef/provider/remote_file/local_file.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/chef/provider/remote_file/local_file.rb b/lib/chef/provider/remote_file/local_file.rb
index d3fdcab24a..026206b64e 100644
--- a/lib/chef/provider/remote_file/local_file.rb
+++ b/lib/chef/provider/remote_file/local_file.rb
@@ -38,13 +38,15 @@ class Chef
path.gsub(/^\/([a-zA-Z]:)/,'\1')
end
- def uri_path
- URI.unescape(uri.path)
+ def source_path
+ @source_path ||= begin
+ path = URI.unescape(uri.path)
+ Chef::Platform.windows? ? fix_windows_path(path) : path
+ end
end
# Fetches the file at uri, returning a Tempfile-like File handle
def fetch
- source_path = Chef::Platform.windows? ? fix_windows_path(uri_path) : uri_path
tempfile = Chef::FileContentManagement::Tempfile.new(new_resource).tempfile
Chef::Log.debug("#{new_resource} staging #{source_path} to #{tempfile.path}")
FileUtils.cp(source_path, tempfile.path)