fog-brightbox 1.7.3 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92ebad94e1526398b760b8a104898cdb2600d3a624e6f77af9b9a2bf24011279
4
- data.tar.gz: 913cf9025ebd5dda7b47b4c2511da1b3f03eea54de7db58a30b1ca15423d592e
3
+ metadata.gz: 1061e46a1ab7bab3542b35bd9a37f966370f5ab44c98d9ce003c56aecabbea47
4
+ data.tar.gz: '09abdac10bca6dbafddf1a7931d0243456caf605c62757e05353b9f8611bf9ab'
5
5
  SHA512:
6
- metadata.gz: 7d7d77edd59fb85d9d5ae125896a6d9f2f572ea7161a1da1eb4f183567f6fbf9682d18b55e648560cfa1ea179006aaa764b15a0fe11502d727038f2d97571cf2
7
- data.tar.gz: 24359f5541ce79e0f658bdd86c039e1b90358e5b1a3defa2b52bc7fd391fbf87f783cdd33f96d4caaffccaa48fefb2b5438f90ff979462cd1b1a8f3c0536150b
6
+ metadata.gz: b587653fc85f39d14e3a9a46bdbff8d83b79046f3fa9baf9de12258db58d3e03c68e22b8930c409c3c5fa2209fc04606fd2d9089737321aaf28bff1c66c3e79f
7
+ data.tar.gz: eff1f83c2b30a808b6b569e73c321788838c2887a9844a129137789c0052fb260e613c71497bc73733d922381d8759615284407c13fc514b1c650adff255f326
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ### 1.8.1 / 2022-12-05
2
+
3
+ Bug fixes:
4
+
5
+ * Remove outdated check for required arguments in `Image.create` model which
6
+ prevented using newer arguments in the latest API version
7
+
8
+ ### 1.8.0 / 2022-08-31
9
+
10
+ Changes:
11
+
12
+ * Allow custom `volume_size` in server creation where supported
13
+
1
14
  ### 1.7.3 / 2022-08-17
2
15
 
3
16
  Bug fixes:
@@ -14,13 +14,16 @@ module Fog
14
14
 
15
15
  attribute :arch
16
16
  attribute :disk_size, type: :integer
17
+ attribute :http_url
17
18
  attribute :licence_name
18
19
  attribute :min_ram, type: :integer
20
+ attribute :server
19
21
  attribute :source
20
22
  attribute :source_trigger
21
23
  attribute :source_type
22
24
  attribute :username
23
25
  attribute :virtual_size, type: :integer
26
+ attribute :volume
24
27
 
25
28
  # Boolean flags
26
29
  attribute :compatibility_mode, type: :boolean
@@ -40,13 +43,16 @@ module Fog
40
43
 
41
44
  def save
42
45
  raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted?
43
- requires :source, :arch
46
+
44
47
  options = {
45
- :source => source,
46
48
  :arch => arch,
49
+ :description => description,
50
+ :http_url => http_url,
47
51
  :name => name,
52
+ :server => server,
53
+ :source => source,
48
54
  :username => username,
49
- :description => description
55
+ :volume => volume
50
56
  }.delete_if { |_k, v| v.nil? || v == "" }
51
57
  data = service.create_image(options)
52
58
  merge_attributes(data)
@@ -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.1"
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Thornthwaite