fog-brightbox 1.7.3 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92ebad94e1526398b760b8a104898cdb2600d3a624e6f77af9b9a2bf24011279
4
- data.tar.gz: 913cf9025ebd5dda7b47b4c2511da1b3f03eea54de7db58a30b1ca15423d592e
3
+ metadata.gz: 2fd48abde8380eb206f3b30abcb6000a8bec7c066d1913649efdde89719f0a79
4
+ data.tar.gz: b75f15aabc38798dcb1a8bcb13eb3e0b66e9ee9fe93beb91e462808d822f9fb7
5
5
  SHA512:
6
- metadata.gz: 7d7d77edd59fb85d9d5ae125896a6d9f2f572ea7161a1da1eb4f183567f6fbf9682d18b55e648560cfa1ea179006aaa764b15a0fe11502d727038f2d97571cf2
7
- data.tar.gz: 24359f5541ce79e0f658bdd86c039e1b90358e5b1a3defa2b52bc7fd391fbf87f783cdd33f96d4caaffccaa48fefb2b5438f90ff979462cd1b1a8f3c0536150b
6
+ metadata.gz: 6ea1059b94824d5ae37fda327001f94704a544fd29bfa7825627599cef850653fdcb55c18d493352af9bb1afd6864faf89c2d824da4baccd9fcdbd0d020096e4
7
+ data.tar.gz: 464af05ddefa022497cce27fb7535eaac5f9db282e32037e922780f0ab05f96eb1f72ccad07f9ad5860c5a2e62228a5a05c676ee83e666507d1a62191e7f3580
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 1.8.0 / 2022-08-31
2
+
3
+ Changes:
4
+
5
+ * Allow custom `volume_size` in server creation where supported
6
+
1
7
  ### 1.7.3 / 2022-08-17
2
8
 
3
9
  Bug fixes:
@@ -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 => [:volume => volume_id])
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
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Brightbox
3
- VERSION = "1.7.3"
3
+ VERSION = "1.8.0"
4
4
  end
5
5
  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 required image_id" do
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").
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-brightbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.3
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Thornthwaite