summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Preston <stuart@chef.io>2018-05-30 00:53:07 +0100
committerStuart Preston <stuart@chef.io>2018-05-30 00:53:07 +0100
commitde8ad2be61013abb893f0fb3955f3f18b4488dde (patch)
treee3a534b5aa8a180e3102a9074c8112548911ecd0
parent99395dfdac0234069ffcd3856f4d871ed20eff3a (diff)
downloadchef-sp/why_run_remote_file.tar.gz
Signed-off-by: Stuart Preston <stuart@chef.io>
-rw-r--r--lib/chef/provider/remote_file/http.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/chef/provider/remote_file/http.rb b/lib/chef/provider/remote_file/http.rb
index fac5e377bf..bd2de5938f 100644
--- a/lib/chef/provider/remote_file/http.rb
+++ b/lib/chef/provider/remote_file/http.rb
@@ -64,13 +64,15 @@ class Chef
def fetch
http = Chef::HTTP::Simple.new(uri, http_client_opts)
orig_tempfile = Chef::FileContentManagement::Tempfile.new(@new_resource).tempfile
- if want_progress?
- tempfile = http.streaming_request_with_progress(uri, headers, orig_tempfile) do |size, total|
- events.resource_update_progress(new_resource, size, total, progress_interval)
+ unless Chef::Config[:why_run]
+ if want_progress?
+ tempfile = http.streaming_request_with_progress(uri, headers, orig_tempfile) do |size, total|
+ events.resource_update_progress(new_resource, size, total, progress_interval)
+ end
+ else
+ tempfile = http.streaming_request(uri, headers, orig_tempfile)
end
- else
- tempfile = http.streaming_request(uri, headers, orig_tempfile)
- end unless Chef::Config[:why_run]
+ end
if tempfile
update_cache_control_data(tempfile, http.last_response)
tempfile.close