summaryrefslogtreecommitdiff
path: root/lib/chef/provider/remote_file
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-12-19 15:17:06 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2017-12-19 15:17:06 -0800
commita909fe71842b874305a3ca5aa2767a4986bcd4c1 (patch)
treef90a6ad162890f0687499778061c8e7c80750593 /lib/chef/provider/remote_file
parent550132f4a37297d9b2b99dcf41ea9298506366ed (diff)
downloadchef-a909fe71842b874305a3ca5aa2767a4986bcd4c1.tar.gz
allow injecting tempfiles into Chef::HTTPlcg/chef-http-inject-tempfile
use this to inject the tempfile from Chef::FileContentManagement::Tempfile closes #2401 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/provider/remote_file')
-rw-r--r--lib/chef/provider/remote_file/http.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/chef/provider/remote_file/http.rb b/lib/chef/provider/remote_file/http.rb
index ad044f9e3c..4732253e5b 100644
--- a/lib/chef/provider/remote_file/http.rb
+++ b/lib/chef/provider/remote_file/http.rb
@@ -61,12 +61,13 @@ class Chef
def fetch
http = Chef::HTTP::Simple.new(uri, http_client_opts)
+ tempfile = Chef::FileContentManagement::Tempfile.new(@new_resource).tempfile
if want_progress?
- tempfile = http.streaming_request_with_progress(uri, headers) do |size, total|
+ tempfile = http.streaming_request_with_progress(uri, headers, tempfile) do |size, total|
events.resource_update_progress(new_resource, size, total, progress_interval)
end
else
- tempfile = http.streaming_request(uri, headers)
+ tempfile = http.streaming_request(uri, headers, tempfile)
end
if tempfile
update_cache_control_data(tempfile, http.last_response)