continuum-stager-api 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/apcera-stager-api-contrib.gemspec +1 -1
- data/lib/apcera/stager/error.rb +1 -0
- data/lib/apcera/stager/stager.rb +17 -3
- data/spec/apcera/stager/stager_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c915dbe247ca720afed7f0c88727537f61422181
|
4
|
+
data.tar.gz: b311c1b061e61b7c3bd082cbee449574ad24b1fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0e7376958039ab0c30e9b44f128a5985e83f9bf8897a21af5ac1c6b0aac2b2e6c1bb81c657ba4e39dccaf302d0f101617f5520949e499ec48356fd53bde305b
|
7
|
+
data.tar.gz: 7044cce662b548f8582f17a4cbb970ea082c14cc5ae9aea41788f1af2487617e2bf9e94ecf72bd0e860578953e7fd54115db485b6862c4efda3be093f46e1989
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.test_files = `git ls-files -- {spec}/*`.split("\n")
|
16
16
|
gem.name = "continuum-stager-api"
|
17
17
|
gem.require_paths = ["lib"]
|
18
|
-
gem.version = "0.1.
|
18
|
+
gem.version = "0.1.9"
|
19
19
|
|
20
20
|
gem.add_development_dependency 'rspec', '~> 2.6.0'
|
21
21
|
gem.add_development_dependency 'rake'
|
data/lib/apcera/stager/error.rb
CHANGED
data/lib/apcera/stager/stager.rb
CHANGED
@@ -15,10 +15,24 @@ module Apcera
|
|
15
15
|
end
|
16
16
|
|
17
17
|
# Download a package from the staging coordinator.
|
18
|
+
# We use Net::HTTP here because it supports streaming downloads.
|
18
19
|
def download
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
uri = URI(@stager_url + "/data")
|
21
|
+
|
22
|
+
Net::HTTP.start(uri.host, uri.port) do |http|
|
23
|
+
request = Net::HTTP::Get.new uri
|
24
|
+
|
25
|
+
http.request request do |response|
|
26
|
+
if response.code.to_i == 200
|
27
|
+
open @pkg_path, 'wb' do |io|
|
28
|
+
response.read_body do |chunk|
|
29
|
+
io.write chunk
|
30
|
+
end
|
31
|
+
end
|
32
|
+
else
|
33
|
+
raise Apcera::Error::DownloadError.new("package download failed.\n")
|
34
|
+
end
|
35
|
+
end
|
22
36
|
end
|
23
37
|
rescue => e
|
24
38
|
fail e
|
@@ -70,7 +70,7 @@ describe Apcera::Stager do
|
|
70
70
|
@stager.should_receive(:exit0r).with(1) { raise }
|
71
71
|
|
72
72
|
VCR.use_cassette('invalid/download') do
|
73
|
-
expect { @stager.download }.to raise_error(
|
73
|
+
expect { @stager.download }.to raise_error(Apcera::Error::DownloadError, "package download failed.\n")
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|