fog-brightbox 1.0.0 → 1.4.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: 92365de2ab00f6e4c7a66c4acc2d7a6e33e74d26069bedfc68ff418f5dfb2056
4
- data.tar.gz: 1211cea76e6b6345d852308cdf8198c9db4a942859e5df3e4dd9aad8dd128d29
3
+ metadata.gz: 7e91c9a644e0cd1ba3d41a180c1d03f5f6b4f30170838cc8119f694dd528737f
4
+ data.tar.gz: 51143d7150551695ea3027a75451c15760c0005b824df2aaeb56d1c73050db34
5
5
  SHA512:
6
- metadata.gz: 1a7db03027f2d25e710d6562d02f6c373140d90841807961e2deb10d169a48f746bd4b731b4f45a07a48f9fd18bf8b437f14e2fa11dd6b38294e20521117279e
7
- data.tar.gz: cd3dd7be1ac30a847d0b60d89a7c9c3ab4c688a26074833870a9baa58e6265ad99c17e7dd8195222485c9f4f350c07850c06b92cfdda98202d627f2476f3d11b
6
+ metadata.gz: 5eb27bf573f92cb3b3ecec889bf62c1ce072a8027e2734d8d4c5238590d6c9f4599388ef52bd6ac8e73b914fb4bf80639ff6a586646f3d06ea997b28903e40c8
7
+ data.tar.gz: 03a47f51347c021bbe3fafbaf1a9dc5d180d6a8995ab8ce18297234bda87aea965dc7f82b5377ba8d062b00ff76164292e420b623cf6b47aa2dc0c0e45d1da53
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7", "3.0", "head"]
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ # uses: ruby/setup-ruby@v1
30
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Run tests
35
+ run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,3 +1,49 @@
1
+ ### 1.4.1 / 2021-04-20
2
+
3
+ Bug fixes:
4
+
5
+ * Fix passing `snapshots_schedule` to database servers as the value was being
6
+ omitted in the model layer. This was preventing creating without a schedule
7
+ causing the default behaviour.
8
+
9
+ ### 1.4.0 / 2021-02-17
10
+
11
+ Changes:
12
+
13
+ * Relax dependencies to allow Ruby 3.0 to be used.
14
+
15
+ ### 1.3.0 / 2020-11-24
16
+
17
+ Changes:
18
+
19
+ * Add `Server#disk_encrypted` attribute to support creation of servers with
20
+ LUKS based encryption at rest.
21
+
22
+ ### 1.2.0 / 2020-11-16
23
+
24
+ Changes:
25
+
26
+ * Add `LoadBalancer#ssl_minimum_version` attribute to configure the TLS/SSL
27
+ version supported by the load balancer.
28
+
29
+ ### 1.1.0 / 2020-06-30
30
+
31
+ Changes:
32
+
33
+ * Add Ruby 2.6 and 2.7 to Travis CI testing matrix.
34
+ * Remove bundler installation step from Travis CI.
35
+ * Use `example.test` for testing domains rather than `example.com` to avoid
36
+ leaking routable traffic.
37
+ * Add `FOG_TEST_COLLABORATOR_EMAIL` to enable ENV based setting of email
38
+ address when using the tests for integation tests.`
39
+
40
+ Bug fixes:
41
+
42
+ * Add `status` check to `ImageSelector` so that unavailable images were not
43
+ selected for use automatically and causing failures in tests.
44
+ * Fix creating database servers from snapshots by adding the `snapshot_id`
45
+ attribute ensuring the value is not filtered when using the model.
46
+
1
47
  ### 1.0.0 / 2018-10-05
2
48
 
3
49
  Major Changes:
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.required_ruby_version = "~> 2.0"
22
+ spec.required_ruby_version = ">= 2.0"
23
23
 
24
24
  spec.add_dependency "fog-core", ">= 1.45", "< 3.0"
25
25
  spec.add_dependency "fog-json"
@@ -28,6 +28,7 @@ module Fog
28
28
  def latest_ubuntu
29
29
  @images.select do |img|
30
30
  img["official"] == true &&
31
+ img["status"] == "available" &&
31
32
  img["arch"] == "i686" &&
32
33
  img["name"] =~ /ubuntu/i
33
34
  end.sort do |a, b|
@@ -46,7 +47,8 @@ module Fog
46
47
  def official_minimal
47
48
  @images.select do |img|
48
49
  img["official"] == true &&
49
- img["virtual_size"] != 0
50
+ img["status"] == "available" &&
51
+ img["virtual_size"] != 0
50
52
  end.sort_by do |img|
51
53
  img["disk_size"]
52
54
  end.first["id"]
@@ -34,6 +34,8 @@ module Fog
34
34
  attribute :flavor_id, "alias" => "database_server_type", :squash => "id"
35
35
  attribute :zone_id, "alias" => "zone", :squash => "id"
36
36
 
37
+ attribute :snapshot_id
38
+
37
39
  attribute :cloud_ips
38
40
 
39
41
  def save
@@ -47,6 +49,9 @@ module Fog
47
49
  options[:maintenance_weekday] = maintenance_weekday
48
50
  options[:maintenance_hour] = maintenance_hour
49
51
 
52
+ options[:snapshots_schedule] = snapshots_schedule
53
+ options[:snapshots_schedule] = nil if snapshots_schedule == ""
54
+
50
55
  if persisted?
51
56
  data = update_database_server(options)
52
57
  else
@@ -54,6 +59,7 @@ module Fog
54
59
  options[:version] = database_version if database_version
55
60
  options[:database_type] = flavor_id if flavor_id
56
61
  options[:zone] = zone_id if zone_id
62
+ options[:snapshot] = snapshot_id if snapshot_id
57
63
 
58
64
  data = create_database_server(options)
59
65
  end
@@ -18,6 +18,8 @@ module Fog
18
18
  attribute :healthcheck
19
19
  attribute :listeners
20
20
 
21
+ attribute :ssl_minimum_version
22
+
21
23
  # These SSL attributes act only as setters. You can not read certs or keys via the API
22
24
  attribute :certificate_pem
23
25
  attribute :certificate_private_key
@@ -58,6 +60,7 @@ module Fog
58
60
  :buffer_size => buffer_size,
59
61
  :certificate_pem => certificate_pem,
60
62
  :certificate_private_key => certificate_private_key,
63
+ :ssl_minimum_version => ssl_minimum_version,
61
64
  :sslv3 => ssl3?
62
65
  }.delete_if { |_k, v| v.nil? || v == "" }
63
66
  data = service.create_load_balancer(options)
@@ -21,6 +21,8 @@ module Fog
21
21
  attribute :fqdn
22
22
  attribute :console_token
23
23
 
24
+ attribute :disk_encrypted
25
+
24
26
  # Times
25
27
  attribute :created_at, :type => :time
26
28
  attribute :started_at, :type => :time
@@ -188,6 +190,7 @@ module Fog
188
190
 
189
191
  options.merge!(:server_type => flavor_id) unless flavor_id.nil? || flavor_id == ""
190
192
  options.merge!(:cloud_ip => cloud_ip) unless cloud_ip.nil? || cloud_ip == ""
193
+ options.merge!(:disk_encrypted => disk_encrypted) if disk_encrypted
191
194
 
192
195
  data = service.create_server(options)
193
196
  merge_attributes(data)
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Brightbox
3
- VERSION = "1.0.0"
3
+ VERSION = "1.4.1"
4
4
  end
5
5
  end
@@ -220,7 +220,7 @@ describe Fog::Brightbox::Config do
220
220
  @options = {
221
221
  :brightbox_client_id => "app-12345",
222
222
  :brightbox_secret => "12345",
223
- :brightbox_username => "user@example.com",
223
+ :brightbox_username => "user@example.test",
224
224
  :brightbox_password => "12345"
225
225
  }
226
226
  @config = Fog::Brightbox::Config.new(@options)
@@ -241,7 +241,7 @@ describe Fog::Brightbox::Config do
241
241
 
242
242
  describe "when setting management_url with URI" do
243
243
  it "sets it correctly" do
244
- uri = URI.parse("https://example.com")
244
+ uri = URI.parse("https://example.test")
245
245
  @config = Fog::Brightbox::Config.new
246
246
  @config.storage_management_url = uri
247
247
  assert_equal @config.storage_management_url, uri
@@ -250,7 +250,7 @@ describe Fog::Brightbox::Config do
250
250
 
251
251
  describe "when setting management_url with String" do
252
252
  it "raises ArgumentError" do
253
- uri = "http://example.com/wrong"
253
+ uri = "http://example.test/wrong"
254
254
  assert_raises(ArgumentError) { Fog::Brightbox::Config.new.storage_management_url = uri }
255
255
  end
256
256
  end
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  describe Fog::Brightbox::LinkHelper do
4
4
  describe "when initialized with an RFC5988 value" do
5
5
  before do
6
- @header = "<https://www.example.com/1.0/images/img-12345>; rel=snapshot"
6
+ @header = "<https://www.example.test/1.0/images/img-12345>; rel=snapshot"
7
7
  @helper = Fog::Brightbox::LinkHelper.new(@header)
8
8
  end
9
9
 
@@ -47,7 +47,7 @@ describe Fog::Brightbox::Storage::AuthenticationRequest do
47
47
  stub_request(:get, "https://orbit.brightbox.com/v1").
48
48
  with(:headers => {
49
49
  "Host" => "orbit.brightbox.com:443",
50
- "X-Auth-User" => "user@example.com",
50
+ "X-Auth-User" => "user@example.test",
51
51
  "X-Auth-Key" => "abcde"
52
52
  }).to_return(authorized_response)
53
53
  end
@@ -56,7 +56,7 @@ describe Fog::Brightbox::Storage::AuthenticationRequest do
56
56
  settings = {
57
57
  :brightbox_client_id => "app-12345",
58
58
  :brightbox_secret => "12345",
59
- :brightbox_username => "user@example.com",
59
+ :brightbox_username => "user@example.test",
60
60
  :brightbox_password => "abcde"
61
61
  }
62
62
  @config = Fog::Brightbox::Config.new(settings)
@@ -70,7 +70,7 @@ describe Fog::Brightbox::Storage::AuthenticationRequest do
70
70
  stub_request(:get, "https://orbit.brightbox.com/v1").
71
71
  with(:headers => {
72
72
  "Host" => "orbit.brightbox.com:443",
73
- "X-Auth-User" => "user@example.com",
73
+ "X-Auth-User" => "user@example.test",
74
74
  "X-Auth-Key" => "abcde"
75
75
  }).to_return(unauthorized_response)
76
76
  end
@@ -79,7 +79,7 @@ describe Fog::Brightbox::Storage::AuthenticationRequest do
79
79
  settings = {
80
80
  :brightbox_client_id => "app-12345",
81
81
  :brightbox_secret => "12345",
82
- :brightbox_username => "user@example.com",
82
+ :brightbox_username => "user@example.test",
83
83
  :brightbox_password => "abcde"
84
84
  }
85
85
  @config = Fog::Brightbox::Config.new(settings)
@@ -19,7 +19,7 @@ describe Fog::Brightbox::Compute::DatabaseServer do
19
19
  end
20
20
  end
21
21
 
22
- describe "when snapshotting withi no options" do
22
+ describe "when snapshotting with no options" do
23
23
  it "returns the database server" do
24
24
  stub_request(:post, "http://localhost/1.0/database_servers/dbs-12345/snapshot").
25
25
  with(:query => hash_including(:account_id),
@@ -47,4 +47,19 @@ describe Fog::Brightbox::Compute::DatabaseServer do
47
47
  assert_kind_of Fog::Brightbox::Compute::DatabaseSnapshot, @database_server.snapshot(true)
48
48
  end
49
49
  end
50
+
51
+ describe "when building from a snapshot" do
52
+ it "returns the new SQL instance" do
53
+ stub_request(:post, "http://localhost/1.0/database_servers").
54
+ with(:query => hash_including(:account_id),
55
+ :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN" },
56
+ :body => hash_including(:snapshot => "dbi-lv426")).
57
+ to_return(:status => 202, :body => %q({"id": "dbs-12345"}))
58
+
59
+ @database_server = Fog::Brightbox::Compute::DatabaseServer.new(:service => service, :snapshot_id => "dbi-lv426")
60
+ @database_server.save
61
+ assert_kind_of Fog::Brightbox::Compute::DatabaseServer, @database_server
62
+ assert_equal "dbs-12345", @database_server.id
63
+ end
64
+ end
50
65
  end
@@ -18,4 +18,28 @@ describe Fog::Brightbox::Compute::LoadBalancer do
18
18
  assert_equal "load_balancer", subject.resource_name
19
19
  end
20
20
  end
21
+
22
+ describe "when creating" do
23
+ it "send correct JSON" do
24
+ options = {
25
+ healthcheck: {},
26
+ listeners: [
27
+ {
28
+ protocol: "http",
29
+ in: 80,
30
+ out: 80
31
+ }
32
+ ],
33
+ nodes: []
34
+ }
35
+
36
+ stub_request(:post, "http://localhost/1.0/load_balancers").
37
+ with(:query => hash_including(:account_id),
38
+ :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN" }).
39
+ to_return(:status => 202, :body => %q({"id": "lba-12345"}), :headers => {})
40
+
41
+ @load_balancer = Fog::Brightbox::Compute::LoadBalancer.new({ :service => service }.merge(options))
42
+ assert @load_balancer.save
43
+ end
44
+ end
21
45
  end
@@ -19,7 +19,49 @@ describe Fog::Brightbox::Compute::Server do
19
19
  end
20
20
  end
21
21
 
22
- describe "when snapshotting withi no options" do
22
+ describe "when creating" do
23
+ describe "with required image_id" do
24
+ it "sends correct JSON" do
25
+ options = {
26
+ image_id: "img-12345"
27
+ }
28
+
29
+ stub_request(:post, "http://localhost/1.0/servers").
30
+ with(:query => hash_including(:account_id),
31
+ :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN",
32
+ "Content-Type" => "application/json" },
33
+ :body => hash_including(:image => "img-12345")).
34
+ to_return(:status => 202, :body => %q({"id":"srv-12345"}), :headers => {})
35
+
36
+ @server = Fog::Brightbox::Compute::Server.new({ :service => service }.merge(options))
37
+ assert @server.save
38
+ end
39
+ end
40
+
41
+ describe "with additional disk_encrypted" do
42
+ it "sends correct JSON" do
43
+ options = {
44
+ image_id: "img-12345",
45
+ disk_encrypted: true
46
+ }
47
+
48
+ stub_request(:post, "http://localhost/1.0/servers").
49
+ with(:query => hash_including(:account_id),
50
+ :headers => { "Authorization" => "Bearer FAKECACHEDTOKEN",
51
+ "Content-Type" => "application/json" },
52
+ :body => hash_including(:disk_encrypted => true)).
53
+ to_return(:status => 202,
54
+ :body => %q({"id":"srv-12345","disk_encrypted":true}),
55
+ :headers => {})
56
+
57
+ @server = Fog::Brightbox::Compute::Server.new({ :service => service }.merge(options))
58
+ assert @server.save
59
+ assert @server.disk_encrypted
60
+ end
61
+ end
62
+ end
63
+
64
+ describe "when snapshotting with no options" do
23
65
  it "returns the server" do
24
66
  stub_request(:post, "http://localhost/1.0/servers/srv-12345/snapshot").
25
67
  with(:query => hash_including(:account_id),
@@ -89,7 +89,7 @@ describe Fog::Brightbox::Storage do
89
89
  {
90
90
  :brightbox_client_id => "app-12345",
91
91
  :brightbox_secret => "12345",
92
- :brightbox_username => "user@example.com",
92
+ :brightbox_username => "user@example.test",
93
93
  :brightbox_password => "abcde",
94
94
  :brightbox_account => "acc-abcde"
95
95
  }
@@ -111,7 +111,7 @@ describe Fog::Brightbox::Storage do
111
111
  {
112
112
  :brightbox_client_id => "app-12345",
113
113
  :brightbox_secret => "12345",
114
- :brightbox_username => "user@example.com",
114
+ :brightbox_username => "user@example.test",
115
115
  :brightbox_password => "abcde"
116
116
  }
117
117
  end
@@ -204,7 +204,7 @@ describe Fog::Brightbox::Storage do
204
204
  {
205
205
  :brightbox_client_id => "app-12345",
206
206
  :brightbox_secret => "12345",
207
- :brightbox_username => "user@example.com",
207
+ :brightbox_username => "user@example.test",
208
208
  :brightbox_password => "12345",
209
209
  :brightbox_access_token => "1234567890abcdefghijklmnopqrstuvwxyz",
210
210
  :brightbox_refresh_token => "1234567890abcdefghijklmnopqrstuvwxyz",
@@ -221,7 +221,7 @@ describe Fog::Brightbox::Storage do
221
221
 
222
222
  # The reauthentication
223
223
  stub_request(:get, "https://files.gb2.brightbox.com/v1").
224
- with(:headers => { "X-Auth-User" => "user@example.com", "X-Auth-Key" => "12345" }).
224
+ with(:headers => { "X-Auth-User" => "user@example.test", "X-Auth-Key" => "12345" }).
225
225
  to_return(authorized_response)
226
226
 
227
227
  # Repeated request
@@ -9,8 +9,8 @@ end
9
9
  Shindo.tests("Fog::Compute.new", ["brightbox"]) do
10
10
  tests("service options") do
11
11
  {
12
- :brightbox_api_url => "https://example.com",
13
- :brightbox_auth_url => "https://example.com",
12
+ :brightbox_api_url => "https://example.test",
13
+ :brightbox_auth_url => "https://example.test",
14
14
  :brightbox_client_id => "app-12345",
15
15
  :brightbox_secret => "12345abdef6789",
16
16
  :brightbox_username => "user-12345",
@@ -1,8 +1,11 @@
1
1
  Shindo.tests("Fog::Compute[:brightbox] | collaboration requests", ["brightbox"]) do
2
2
  tests("success") do
3
+ @test_collaborator_email = ENV["FOG_TEST_COLLABORATOR_EMAIL"]
4
+ pending unless @test_collaborator_email
5
+
3
6
  tests("#create_collaboration") do
4
7
  pending if Fog.mocking?
5
- collaboration = Fog::Compute[:brightbox].create_collaboration(:email => "paul@example.com", :role => "admin")
8
+ collaboration = Fog::Compute[:brightbox].create_collaboration(:email => @test_collaborator_email, :role => "admin")
6
9
  @collaboration_id = collaboration["id"]
7
10
  formats(Brightbox::Compute::Formats::Full::COLLABORATION, false) { collaboration }
8
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-brightbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Thornthwaite
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-05 00:00:00.000000000 Z
11
+ date: 1970-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -163,10 +163,10 @@ executables: []
163
163
  extensions: []
164
164
  extra_rdoc_files: []
165
165
  files:
166
+ - ".github/workflows/ruby.yml"
166
167
  - ".gitignore"
167
168
  - ".rubocop.yml"
168
169
  - ".rubocop_todo.yml"
169
- - ".travis.yml"
170
170
  - CHANGELOG.md
171
171
  - Gemfile
172
172
  - LICENSE.txt
@@ -456,7 +456,7 @@ require_paths:
456
456
  - lib
457
457
  required_ruby_version: !ruby/object:Gem::Requirement
458
458
  requirements:
459
- - - "~>"
459
+ - - ">="
460
460
  - !ruby/object:Gem::Version
461
461
  version: '2.0'
462
462
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -465,8 +465,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
465
465
  - !ruby/object:Gem::Version
466
466
  version: '0'
467
467
  requirements: []
468
- rubyforge_project:
469
- rubygems_version: 2.7.6
468
+ rubygems_version: 3.0.6
470
469
  signing_key:
471
470
  specification_version: 4
472
471
  summary: This library can be used as a module for `fog` or as standalone provider
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5
5
- - 2.4
6
- - 2.3
7
- - 2.2
8
- - 2.1
9
- - 2.0
10
- before_install:
11
- - gem install bundler