diff options
-rw-r--r-- | lib/chef/provider/remote_file/http.rb | 14 |
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 |