fog-brightbox 1.7.3 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/fog/brightbox/models/compute/server.rb +11 -1
- data/lib/fog/brightbox/version.rb +1 -1
- data/spec/fog/compute/brightbox/server_spec.rb +49 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fd48abde8380eb206f3b30abcb6000a8bec7c066d1913649efdde89719f0a79
|
4
|
+
data.tar.gz: b75f15aabc38798dcb1a8bcb13eb3e0b66e9ee9fe93beb91e462808d822f9fb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ea1059b94824d5ae37fda327001f94704a544fd29bfa7825627599cef850653fdcb55c18d493352af9bb1afd6864faf89c2d824da4baccd9fcdbd0d020096e4
|
7
|
+
data.tar.gz: 464af05ddefa022497cce27fb7535eaac5f9db282e32037e922780f0ab05f96eb1f72ccad07f9ad5860c5a2e62228a5a05c676ee83e666507d1a62191e7f3580
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,7 @@ module Fog
|
|
8
8
|
include Fog::Brightbox::Compute::ResourceLocking
|
9
9
|
|
10
10
|
attr_accessor :volume_id
|
11
|
+
attr_accessor :volume_size
|
11
12
|
|
12
13
|
identity :id
|
13
14
|
attribute :resource_type
|
@@ -197,7 +198,16 @@ module Fog
|
|
197
198
|
options.merge!(:disk_encrypted => disk_encrypted) if disk_encrypted
|
198
199
|
|
199
200
|
if volume_id
|
200
|
-
options.merge!(:volumes => [:
|
201
|
+
options.merge!(:volumes => [{ volume: volume_id }])
|
202
|
+
elsif volume_size
|
203
|
+
options.merge!(
|
204
|
+
volumes: [
|
205
|
+
{
|
206
|
+
image: image_id,
|
207
|
+
size: volume_size
|
208
|
+
}
|
209
|
+
]
|
210
|
+
)
|
201
211
|
else
|
202
212
|
options.merge!(:image => image_id)
|
203
213
|
end
|
@@ -20,7 +20,7 @@ describe Fog::Brightbox::Compute::Server do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
describe "when creating" do
|
23
|
-
describe "with
|
23
|
+
describe "with image_id" do
|
24
24
|
it "sends correct JSON" do
|
25
25
|
options = {
|
26
26
|
image_id: "img-12345"
|
@@ -38,6 +38,33 @@ describe Fog::Brightbox::Compute::Server do
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
+
describe "with image_id and custom size" do
|
42
|
+
it "sends correct JSON" do
|
43
|
+
options = {
|
44
|
+
image_id: "img-12345",
|
45
|
+
volume_size: 25_000
|
46
|
+
}
|
47
|
+
expected_args = {
|
48
|
+
volumes: [
|
49
|
+
{
|
50
|
+
image: "img-12345",
|
51
|
+
size: 25_000
|
52
|
+
}
|
53
|
+
]
|
54
|
+
}
|
55
|
+
|
56
|
+
stub_request(:post, "http://localhost/1.0/servers").
|
57
|
+
with(:query => hash_including(:account_id),
|
58
|
+
:headers => { "Authorization" => "Bearer FAKECACHEDTOKEN",
|
59
|
+
"Content-Type" => "application/json" },
|
60
|
+
:body => hash_including(expected_args)).
|
61
|
+
to_return(:status => 202, :body => %q({"id":"srv-12345"}), :headers => {})
|
62
|
+
|
63
|
+
@server = Fog::Brightbox::Compute::Server.new({ :service => service }.merge(options))
|
64
|
+
assert @server.save
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
41
68
|
describe "with additional disk_encrypted" do
|
42
69
|
it "sends correct JSON" do
|
43
70
|
options = {
|
@@ -61,6 +88,27 @@ describe Fog::Brightbox::Compute::Server do
|
|
61
88
|
end
|
62
89
|
end
|
63
90
|
|
91
|
+
describe "with volume_id" do
|
92
|
+
it "sends correct JSON" do
|
93
|
+
options = {
|
94
|
+
volume_id: "vol-12345"
|
95
|
+
}
|
96
|
+
expected_args = {
|
97
|
+
volumes: [{ volume: "vol-12345" }]
|
98
|
+
}
|
99
|
+
|
100
|
+
stub_request(:post, "http://localhost/1.0/servers").
|
101
|
+
with(:query => hash_including(:account_id),
|
102
|
+
:headers => { "Authorization" => "Bearer FAKECACHEDTOKEN",
|
103
|
+
"Content-Type" => "application/json" },
|
104
|
+
:body => hash_including(expected_args)).
|
105
|
+
to_return(:status => 202, :body => %q({"id":"srv-12345"}), :headers => {})
|
106
|
+
|
107
|
+
@server = Fog::Brightbox::Compute::Server.new({ :service => service }.merge(options))
|
108
|
+
assert @server.save
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
64
112
|
describe "when snapshotting with no options" do
|
65
113
|
it "returns the server" do
|
66
114
|
stub_request(:post, "http://localhost/1.0/servers/srv-12345/snapshot").
|