summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-02-09 14:20:35 -0800
committerThom May <thom@chef.io>2016-02-09 14:20:35 -0800
commitd17661e30c1e08a14d17dcfa6ce46f81086fc1ec (patch)
treedfcda354e2248d5d544b32b53b3b8debc97db592
parentb4b91836f0b2f0e09e089acab43e410cd73e48a4 (diff)
downloadchef-d17661e30c1e08a14d17dcfa6ce46f81086fc1ec.tar.gz
Ensure we do streaming requests correctly everywheretm/site_download_regression
-rw-r--r--lib/chef/cookbook/remote_file_vendor.rb2
-rw-r--r--lib/chef/knife/cookbook_show.rb2
-rw-r--r--spec/unit/knife/cookbook_show_spec.rb10
3 files changed, 7 insertions, 7 deletions
diff --git a/lib/chef/cookbook/remote_file_vendor.rb b/lib/chef/cookbook/remote_file_vendor.rb
index 9155162c4c..e63d094dc4 100644
--- a/lib/chef/cookbook/remote_file_vendor.rb
+++ b/lib/chef/cookbook/remote_file_vendor.rb
@@ -63,7 +63,7 @@ class Chef
# (remote, per manifest), do the update. This will also execute if there
# is no current checksum.
if current_checksum != found_manifest_record["checksum"]
- raw_file = @rest.get(found_manifest_record[:url], true)
+ raw_file = @rest.streaming_request(found_manifest_record[:url])
Chef::Log.debug("Storing updated #{cache_filename} in the cache.")
Chef::FileCache.move_to(raw_file.path, cache_filename)
diff --git a/lib/chef/knife/cookbook_show.rb b/lib/chef/knife/cookbook_show.rb
index 20013cea4b..5fab7c303f 100644
--- a/lib/chef/knife/cookbook_show.rb
+++ b/lib/chef/knife/cookbook_show.rb
@@ -69,7 +69,7 @@ class Chef
cookbook = rest.get("cookbooks/#{cookbook_name}/#{cookbook_version}")
manifest_entry = cookbook.preferred_manifest_record(node, segment, filename)
- temp_file = rest.get(manifest_entry[:url], true)
+ temp_file = rest.streaming_request(manifest_entry[:url])
# the temp file is cleaned up elsewhere
temp_file.open if temp_file.closed?
diff --git a/spec/unit/knife/cookbook_show_spec.rb b/spec/unit/knife/cookbook_show_spec.rb
index de6d569e1d..0183577ec1 100644
--- a/spec/unit/knife/cookbook_show_spec.rb
+++ b/spec/unit/knife/cookbook_show_spec.rb
@@ -126,7 +126,7 @@ describe Chef::Knife::CookbookShow do
it "should print the raw result of the request (likely a file!)" do
expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
- expect(@rest).to receive(:get).with("http://example.org/files/default.rb", true).and_return(StringIO.new(@response))
+ expect(@rest).to receive(:streaming_request).with("http://example.org/files/default.rb").and_return(StringIO.new(@response))
expect(@knife).to receive(:pretty_print).with(@response)
@knife.run
end
@@ -178,7 +178,7 @@ describe Chef::Knife::CookbookShow do
@knife.config[:platform_version] = "1.0"
@knife.config[:fqdn] = "examplehost.example.org"
expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
- expect(@rest).to receive(:get).with("http://example.org/files/1111", true).and_return(StringIO.new(@response))
+ expect(@rest).to receive(:streaming_request).with("http://example.org/files/1111").and_return(StringIO.new(@response))
expect(@knife).to receive(:pretty_print).with(@response)
@knife.run
end
@@ -190,7 +190,7 @@ describe Chef::Knife::CookbookShow do
@knife.config[:platform_version] = "1.0"
@knife.config[:fqdn] = "differenthost.example.org"
expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
- expect(@rest).to receive(:get).with("http://example.org/files/3333", true).and_return(StringIO.new(@response))
+ expect(@rest).to receive(:streaming_request).with("http://example.org/files/3333").and_return(StringIO.new(@response))
expect(@knife).to receive(:pretty_print).with(@response)
@knife.run
end
@@ -202,7 +202,7 @@ describe Chef::Knife::CookbookShow do
@knife.config[:platform_version] = "9.10"
@knife.config[:fqdn] = "differenthost.example.org"
expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
- expect(@rest).to receive(:get).with("http://example.org/files/2222", true).and_return(StringIO.new(@response))
+ expect(@rest).to receive(:streaming_request).with("http://example.org/files/2222").and_return(StringIO.new(@response))
expect(@knife).to receive(:pretty_print).with(@response)
@knife.run
end
@@ -211,7 +211,7 @@ describe Chef::Knife::CookbookShow do
describe "with none of the arguments, it should use the default" do
it "should pass them all" do
expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response)
- expect(@rest).to receive(:get).with("http://example.org/files/4444", true).and_return(StringIO.new(@response))
+ expect(@rest).to receive(:streaming_request).with("http://example.org/files/4444").and_return(StringIO.new(@response))
expect(@knife).to receive(:pretty_print).with(@response)
@knife.run
end