brightbox-cli 2.11.2 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +36 -0
  3. data/.travis.yml +0 -3
  4. data/CHANGELOG.md +58 -0
  5. data/Gemfile.lock +22 -18
  6. data/Jenkinsfile +7 -18
  7. data/Rakefile +2 -12
  8. data/brightbox-cli.gemspec +3 -3
  9. data/lib/brightbox-cli/api.rb +1 -1
  10. data/lib/brightbox-cli/cloud_ips.rb +1 -1
  11. data/lib/brightbox-cli/collaboration.rb +1 -1
  12. data/lib/brightbox-cli/commands/firewall/policies-update.rb +1 -1
  13. data/lib/brightbox-cli/commands/lbs/create.rb +5 -0
  14. data/lib/brightbox-cli/commands/lbs/show.rb +1 -0
  15. data/lib/brightbox-cli/commands/lbs/update.rb +7 -0
  16. data/lib/brightbox-cli/commands/servers/create.rb +5 -0
  17. data/lib/brightbox-cli/commands/token.rb +16 -1
  18. data/lib/brightbox-cli/detailed_server.rb +1 -0
  19. data/lib/brightbox-cli/load_balancers.rb +1 -0
  20. data/lib/brightbox-cli/version.rb +1 -1
  21. data/spec/commands/cloudips/update_spec.rb +65 -0
  22. data/spec/commands/lbs/create_spec.rb +31 -0
  23. data/spec/commands/lbs/update_spec.rb +32 -0
  24. data/spec/commands/servers/create_spec.rb +24 -8
  25. data/spec/commands/sql/instances/create_spec.rb +26 -0
  26. data/spec/support/shared/collaborating_accounts_context.rb +3 -3
  27. data/spec/unit/brightbox/account/all_spec.rb +2 -2
  28. data/spec/unit/brightbox/account/get_spec.rb +2 -2
  29. data/spec/unit/brightbox/api/conn_spec.rb +1 -1
  30. data/spec/unit/brightbox/collaborating_account_spec.rb +1 -1
  31. data/spec/unit/brightbox/connection_manager/fetch_connection_spec.rb +1 -1
  32. data/spec/unit/brightbox/database_server/cloud_ips_spec.rb +1 -1
  33. data/spec/unit/brightbox/database_server/maintenance_window_spec.rb +1 -1
  34. data/spec/unit/brightbox/user_collaboration/get_for_account_spec.rb +1 -1
  35. data/spec/unit/brightbox/user_collaboration/remove_spec.rb +1 -1
  36. metadata +9 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f37c9c63622674d0abcab2e4322d1e087a87ca656f0893064e9116adf443d686
4
- data.tar.gz: 01d93f26714e55f2b49b97fe9f89c027789431b4d51534835318ca33f28f4305
3
+ metadata.gz: d5c03039c9263c4872064938223b825be9550d1c08e2a77d438b68f1fd7b42cc
4
+ data.tar.gz: 85f994952c28133cf8ad08c70d16228b165373f94a90916a0a83fe365e14672d
5
5
  SHA512:
6
- metadata.gz: 7905407733ca6343b596ff0c51ea9edce92f850d4bed7c86a1dcf214f8ad6098c19a861df69d642ecb568ffdaf72b764d525596e5d5cae7ee6b8a6397daa2f4d
7
- data.tar.gz: bec68ef541a8d3a2a2adb7951abeddae676d98b4c3f3da15b1506a7aeab791cfa82eda052901a7d811203d72559f3ec5ffa0c3f05a3aca220476c7d85d9f8b31
6
+ metadata.gz: 013e062376468560718cfbf25c2e2221db7e0808bcadc6413b6cbf5532b966917de0e2c40d2ffd1a859f8fd78267c28b86166e5638d2869cfe22e9c315bd8a4b
7
+ data.tar.gz: f81c26c3a3705e6caa3399e1598e4c8ad399f175a0be4d26c2383ccfab8a8cfc75c2ebde0135aa9cee2f4cd220df2119a4d3a880b4c585b3dfc113384cfe57e6
@@ -0,0 +1,36 @@
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
+
21
+ strategy:
22
+ matrix:
23
+ ruby: ["2.4", "2.5", "2.6", "2.7"]
24
+
25
+ steps:
26
+ - uses: actions/checkout@v2
27
+ - name: Set up Ruby ${{ matrix.ruby }}
28
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
29
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
30
+ uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby }}
33
+ - name: Install dependencies
34
+ run: bundle install
35
+ - name: Run tests
36
+ run: bundle exec rake
@@ -2,10 +2,7 @@ language: ruby
2
2
  sudo: false
3
3
 
4
4
  rvm:
5
- - 1.9
6
5
  - 2.0
7
6
  - 2.1
8
7
  - 2.2
9
8
  - 2.3
10
- - 2.4
11
- - 2.6
@@ -1,3 +1,61 @@
1
+ ### v3.2.0 / 2020-11-26
2
+
3
+ [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v3.1.0...v3.2.0)
4
+
5
+ Changes:
6
+
7
+ * Add `--disk-encrypted` option to server creation to allow enabling encryption
8
+ at rest during a build.
9
+ * Setup GitHub Actions for Ruby 2.4+ builds to reduce the delays of testing
10
+ using Travis.
11
+ * Reduce number of Travis builds due to incredibly slow start up times. We are
12
+ approaching an hour to get a build taking less than a minute starting.
13
+
14
+ ### v3.1.0 / 2020-11-17
15
+
16
+ [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v3.0.1...v3.1.0)
17
+
18
+ Changes:
19
+
20
+ * Update `fog-brightbox` to v1.2.0
21
+ * Add `lbs` option for `--min-ssl-ver` to specify the minimum TLS/SSL protocol
22
+ that should be acceptable for use with the load balancer
23
+
24
+ ### v3.0.1 / 2020-07-01
25
+
26
+ [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v3.0.0...v3.0.1)
27
+
28
+ Bug fixes:
29
+
30
+ * Fix `cloudips update --name` to correctly set blank names
31
+
32
+ ### v3.0.0 / 2020-07-01
33
+
34
+ [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v2.12.0...v3.0.0)
35
+
36
+ Backwards incompatible changes:
37
+
38
+ * Dropped support for Ruby 1.9
39
+
40
+ Changes:
41
+
42
+ * Update `fog-brightbox` to v1.1.0
43
+ * Update `rake` to v12.3.3 to resolve CVE-2020-8130
44
+ * Update `rspec` to v3.9 to avoid issue when updating `rake`
45
+
46
+ Bug fixes:
47
+
48
+ * Creating an SQL instance from an existing snapshot has been fixed following
49
+ the update for `fog-brightbox v1.1.0`
50
+
51
+ ### v2.12.0 / 2020-01-28
52
+
53
+ [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v2.11.2...v2.12.0)
54
+
55
+ Enhancements:
56
+
57
+ * Adds `token create` to always attempt to reauthenticate and display a token.
58
+
1
59
  ### v2.11.2 / 2020-01-07
2
60
 
3
61
  [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v2.11.1...v2.11.2)
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brightbox-cli (2.11.2)
4
+ brightbox-cli (3.2.0)
5
5
  dry-inflector (< 0.2)
6
- fog-brightbox (>= 0.16.0, < 1.0)
6
+ fog-brightbox (>= 1.3.0)
7
7
  fog-core (< 2.0)
8
8
  gli (~> 2.12.0)
9
9
  highline (~> 1.6.0)
@@ -20,14 +20,13 @@ GEM
20
20
  coderay (1.0.9)
21
21
  crack (0.4.2)
22
22
  safe_yaml (~> 1.0.0)
23
- diff-lcs (1.2.5)
23
+ diff-lcs (1.4.3)
24
24
  dry-inflector (0.1.2)
25
- excon (0.71.1)
26
- fog-brightbox (0.16.1)
25
+ excon (0.78.0)
26
+ fog-brightbox (1.3.0)
27
27
  dry-inflector
28
- fog-core
28
+ fog-core (>= 1.45, < 3.0)
29
29
  fog-json
30
- mime-types
31
30
  fog-core (1.45.0)
32
31
  builder
33
32
  excon (~> 0.58)
@@ -53,15 +52,20 @@ GEM
53
52
  pry-remote (0.1.8)
54
53
  pry (~> 0.9)
55
54
  slop (~> 3.0)
56
- rake (10.1.0)
57
- rspec (2.99.0)
58
- rspec-core (~> 2.99.0)
59
- rspec-expectations (~> 2.99.0)
60
- rspec-mocks (~> 2.99.0)
61
- rspec-core (2.99.1)
62
- rspec-expectations (2.99.1)
63
- diff-lcs (>= 1.1.3, < 2.0)
64
- rspec-mocks (2.99.1)
55
+ rake (12.3.3)
56
+ rspec (3.9.0)
57
+ rspec-core (~> 3.9.0)
58
+ rspec-expectations (~> 3.9.0)
59
+ rspec-mocks (~> 3.9.0)
60
+ rspec-core (3.9.2)
61
+ rspec-support (~> 3.9.3)
62
+ rspec-expectations (3.9.2)
63
+ diff-lcs (>= 1.2.0, < 2.0)
64
+ rspec-support (~> 3.9.0)
65
+ rspec-mocks (3.9.1)
66
+ diff-lcs (>= 1.2.0, < 2.0)
67
+ rspec-support (~> 3.9.0)
68
+ rspec-support (3.9.3)
65
69
  safe_yaml (1.0.4)
66
70
  slop (3.4.5)
67
71
  vcr (2.5.0)
@@ -77,9 +81,9 @@ DEPENDENCIES
77
81
  mocha
78
82
  pry-remote
79
83
  rake
80
- rspec (~> 2.99)
84
+ rspec
81
85
  vcr (~> 2.5)
82
86
  webmock
83
87
 
84
88
  BUNDLED WITH
85
- 1.16.6
89
+ 1.17.3
@@ -9,17 +9,6 @@ pipeline {
9
9
  stages {
10
10
  stage("Run tests") {
11
11
  parallel {
12
- stage("Ruby 1.9.3") {
13
- agent {
14
- docker {
15
- image 'ruby:1.9.3'
16
- }
17
- }
18
- steps {
19
- sh 'BUNDLE_APP_CONFIG=/tmp/bundle.config BUNDLE_DISABLE_SHARED_GEMS=true bundle install --deployment'
20
- sh 'BUNDLE_APP_CONFIG=/tmp/bundle.config bundle exec rake test'
21
- }
22
- }
23
12
  stage("Ruby 2.0") {
24
13
  agent {
25
14
  docker {
@@ -28,7 +17,7 @@ pipeline {
28
17
  }
29
18
  steps {
30
19
  sh 'bundle install --deployment'
31
- sh 'bundle exec rake test'
20
+ sh 'bundle exec rake spec'
32
21
  }
33
22
  }
34
23
  stage("Ruby 2.1") {
@@ -39,7 +28,7 @@ pipeline {
39
28
  }
40
29
  steps {
41
30
  sh 'bundle install --deployment'
42
- sh 'bundle exec rake test'
31
+ sh 'bundle exec rake spec'
43
32
  }
44
33
  }
45
34
  stage("Ruby 2.2") {
@@ -50,7 +39,7 @@ pipeline {
50
39
  }
51
40
  steps {
52
41
  sh 'bundle install --deployment'
53
- sh 'bundle exec rake test'
42
+ sh 'bundle exec rake spec'
54
43
  }
55
44
  }
56
45
  stage("Ruby 2.3") {
@@ -61,7 +50,7 @@ pipeline {
61
50
  }
62
51
  steps {
63
52
  sh 'bundle install --deployment'
64
- sh 'bundle exec rake test'
53
+ sh 'bundle exec rake spec'
65
54
  }
66
55
  }
67
56
  stage("Ruby 2.4") {
@@ -72,7 +61,7 @@ pipeline {
72
61
  }
73
62
  steps {
74
63
  sh 'bundle install --deployment'
75
- sh 'bundle exec rake test'
64
+ sh 'bundle exec rake spec'
76
65
  }
77
66
  }
78
67
  stage("Ruby 2.5") {
@@ -83,7 +72,7 @@ pipeline {
83
72
  }
84
73
  steps {
85
74
  sh 'bundle install --deployment'
86
- sh 'bundle exec rake test'
75
+ sh 'bundle exec rake spec'
87
76
  }
88
77
  }
89
78
  stage("Ruby 2.6") {
@@ -94,7 +83,7 @@ pipeline {
94
83
  }
95
84
  steps {
96
85
  sh 'bundle install --deployment'
97
- sh 'bundle exec rake test'
86
+ sh 'bundle exec rake spec'
98
87
  }
99
88
  }
100
89
  }
data/Rakefile CHANGED
@@ -1,16 +1,6 @@
1
- require "bundler"
2
1
  require "rspec/core/rake_task"
3
2
 
4
- bbcloud_path = File.expand_path("./lib", File.dirname(__FILE__))
5
- $LOAD_PATH.unshift(bbcloud_path)
6
-
7
- task :default => [:test]
8
-
9
3
  Bundler::GemHelper.install_tasks
4
+ RSpec::Core::RakeTask.new(:spec)
10
5
 
11
- RSpec::Core::RakeTask.new
12
-
13
- desc "Runs all tests (rspec and cucumber)"
14
- task :test do
15
- Rake::Task["spec"].invoke
16
- end
6
+ task :default => :spec
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.description = %q(Scripts to interact with the Brightbox cloud API)
13
13
  s.license = "MIT"
14
14
 
15
- s.required_ruby_version = ">= 1.9.3"
15
+ s.required_ruby_version = ">= 2.0"
16
16
 
17
17
  s.rubyforge_project = "brightbox-cli"
18
18
 
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
22
22
  s.require_paths = ["lib"]
23
23
 
24
- s.add_dependency "fog-brightbox", ">= 0.16.0", "< 1.0"
24
+ s.add_dependency "fog-brightbox", ">= 1.3.0"
25
25
  s.add_dependency "fog-core", "< 2.0"
26
26
  s.add_dependency "gli", "~> 2.12.0"
27
27
  s.add_dependency "i18n", "~> 0.6.0"
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
36
36
  s.add_development_dependency "mocha"
37
37
  s.add_development_dependency "pry-remote"
38
38
  s.add_development_dependency "rake"
39
- s.add_development_dependency "rspec", "~> 2.99"
39
+ s.add_development_dependency "rspec"
40
40
  s.add_development_dependency "vcr", "~> 2.5"
41
41
  s.add_development_dependency "webmock"
42
42
 
@@ -16,7 +16,7 @@ module Brightbox
16
16
  # Returns the current connection to the Brightbox API, creating a new
17
17
  # {ConnectionManager} and connection if necessary.
18
18
  #
19
- # @return [Fog::Compute::Brightbox::Real]
19
+ # @return [Fog::Brightbox::Compute::Real]
20
20
  #
21
21
  def self.conn
22
22
  if @@connection_manager
@@ -75,7 +75,7 @@ module Brightbox
75
75
  params[:reverse_dns] = ""
76
76
  end
77
77
 
78
- if options[:n] && !options[:name].empty?
78
+ if options[:n] && !options[:n].nil?
79
79
  params[:name] = options[:n]
80
80
  end
81
81
 
@@ -9,7 +9,7 @@ module Brightbox
9
9
  def self.invite(email, role)
10
10
  options = { :email => email, :role => role }
11
11
  data = conn.create_collaboration(options)
12
- model = Fog::Compute::Brightbox::Collaboration.new(data)
12
+ model = Fog::Brightbox::Compute::Collaboration.new(data)
13
13
  new(model)
14
14
  end
15
15
 
@@ -36,7 +36,7 @@ module Brightbox
36
36
  # with a request, before updating the model
37
37
  data = FirewallPolicy.conn.update_firewall_policy(policy_id, params)
38
38
 
39
- model = Fog::Compute::Brightbox::FirewallPolicy.new(data)
39
+ model = Fog::Brightbox::Compute::FirewallPolicy.new(data)
40
40
  policy = FirewallPolicy.new(model)
41
41
 
42
42
  render_table([policy], global_options)
@@ -52,6 +52,10 @@ module Brightbox
52
52
  c.desc "Filepath to the private key used to sign SSL certificate (OpenSSL supported formats)."
53
53
  c.flag ["ssl-key"]
54
54
 
55
+ c.desc "Sets the minimum version of TLS/SSL to support in the format 'TLSv1.x'"
56
+ c.default_value "TLSv1.2"
57
+ c.flag ["ssl-min-ver"]
58
+
55
59
  c.desc "Enable SSL v3 support"
56
60
  c.switch ["sslv3"]
57
61
 
@@ -118,6 +122,7 @@ module Brightbox
118
122
  :listeners => listeners,
119
123
  :certificate_pem => ssl_cert,
120
124
  :certificate_private_key => ssl_key,
125
+ :ssl_minimum_version => options["ssl-min-ver"],
121
126
  :sslv3 => options["sslv3"],
122
127
  :nodes => nodes)
123
128
  render_table([lb], global_options)
@@ -18,6 +18,7 @@ module Brightbox
18
18
  :created_at,
19
19
  :deleted_at,
20
20
  :policy,
21
+ :ssl_minimum_version,
21
22
  :ssl_issuer,
22
23
  :ssl_subject,
23
24
  :ssl_valid_from,
@@ -45,6 +45,9 @@ module Brightbox
45
45
  c.desc "Filepath to the private key used to sign SSL certificate (OpenSSL supported formats)."
46
46
  c.flag ["ssl-key"]
47
47
 
48
+ c.desc "Sets the minimum version of TLS/SSL to support in the format 'TLSv1.x'"
49
+ c.flag ["ssl-min-ver"]
50
+
48
51
  c.desc "Clears SSL details from the load balancer."
49
52
  c.switch ["remove-ssl"], :negatable => false
50
53
 
@@ -128,6 +131,10 @@ module Brightbox
128
131
  lbopts[:certificate_private_key] = ""
129
132
  end
130
133
 
134
+ if options["ssl-min-ver"]
135
+ lbopts[:ssl_minimum_version] = options["ssl-min-ver"] unless options["ssl-min-ver"].nil?
136
+ end
137
+
131
138
  lbopts.nilify_blanks
132
139
 
133
140
  lb = LoadBalancer.find lb_id
@@ -29,6 +29,10 @@ module Brightbox
29
29
  c.default_value true
30
30
  c.switch [:e, :base64], :negatable => true
31
31
 
32
+ c.desc "Enable encryption at rest for disk"
33
+ c.default_value false
34
+ c.switch ["disk-encrypted"], :negatable => false
35
+
32
36
  c.desc "Server groups to place server in - comma delimited list"
33
37
  c.flag [:g, "server-groups"]
34
38
 
@@ -116,6 +120,7 @@ module Brightbox
116
120
  }
117
121
 
118
122
  params[:cloud_ip] = options[:"cloud-ip"] if options.key?(:"cloud-ip")
123
+ params[:disk_encrypted] = options[:"disk-encrypted"] if options.key?(:"disk-encrypted")
119
124
 
120
125
  servers = Server.create_servers options[:i], params
121
126
  render_table(servers, global_options)
@@ -10,10 +10,25 @@ module Brightbox
10
10
  c.default_value "text"
11
11
  c.flag [:format]
12
12
 
13
- c.action do |global_options, options, args|
13
+ c.action do |_, options, _|
14
+ token = Token.show(Brightbox.config, options)
15
+ $stdout.puts token.format(options[:format] || "text")
16
+ end
17
+ end
18
+
19
+ cmd.desc "Create new OAuth2 Bearer token"
20
+ cmd.command [:create] do |c|
21
+ c.desc "Either 'text', 'token', 'json' or 'curl'"
22
+ c.arg_name "format"
23
+ c.default_value "text"
24
+ c.flag [:format]
25
+
26
+ c.action do |_, options, _|
27
+ config.reauthenticate
14
28
  token = Token.show(Brightbox.config, options)
15
29
  $stdout.puts token.format(options[:format])
16
30
  end
17
31
  end
32
+
18
33
  end
19
34
  end
@@ -49,6 +49,7 @@ module Brightbox
49
49
  :ram,
50
50
  :cores,
51
51
  :disk,
52
+ :disk_encrypted,
52
53
  :compatibility_mode,
53
54
  :image,
54
55
  :image_name,
@@ -12,6 +12,7 @@ module Brightbox
12
12
  def to_row
13
13
  attributes.merge(
14
14
  :locked => locked?,
15
+ :ssl_minimum_version => ssl_minimum_version,
15
16
  :ssl_issuer => certificate_issuer,
16
17
  :ssl_subject => certificate_subject,
17
18
  :ssl_valid_from => certificate_valid_from,
@@ -1,3 +1,3 @@
1
1
  module Brightbox
2
- VERSION = "2.11.2" unless defined?(Brightbox::VERSION)
2
+ VERSION = "3.2.0" unless defined?(Brightbox::VERSION)
3
3
  end
@@ -7,6 +7,13 @@ describe "brightbox cloudips" do
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
+ before do
11
+ config_from_contents(USER_APP_CONFIG_CONTENTS)
12
+
13
+ stub_request(:post, "http://api.brightbox.dev/token").
14
+ to_return(status: 200, body: JSON.dump(access_token: "ACCESS-TOKEN", refresh_token: "REFRESH-TOKEN"))
15
+ end
16
+
10
17
  context "" do
11
18
  let(:argv) { %w(cloudips update) }
12
19
 
@@ -14,5 +21,63 @@ describe "brightbox cloudips" do
14
21
  expect { output }.to_not raise_error
15
22
  end
16
23
  end
24
+
25
+ context "when name is updated" do
26
+ let(:argv) { ["cloudips", "update", "--name=#{new_name}", "cip-12345"] }
27
+
28
+ let(:json_response) do
29
+ <<-EOS
30
+ {
31
+ "id":"cip-12345",
32
+ "name":"#{new_name}"
33
+ }
34
+ EOS
35
+ end
36
+
37
+ context "--name 'New name'" do
38
+ let(:new_name) { "New name" }
39
+ let(:expected_args) { ["cip-12345", { :name => new_name }] }
40
+
41
+ before do
42
+ stub_request(:put, "http://api.brightbox.dev/1.0/cloud_ips/cip-12345?account_id=acc-12345")
43
+ .with(:headers => { "Content-Type" => "application/json" },
44
+ :body => hash_including("name" => "New name"))
45
+ .and_return(:status => 200, :body => json_response)
46
+
47
+ stub_request(:get, "http://api.brightbox.dev/1.0/cloud_ips/cip-12345?account_id=acc-12345")
48
+ .with(:headers => { "Content-Type" => "application/json" })
49
+ .and_return(:status => 200, :body => json_response)
50
+ end
51
+
52
+ it "puts new name in update" do
53
+ expect(Brightbox::CloudIP.conn).to receive(:update_cloud_ip).with(*expected_args).and_call_original
54
+ expect(stderr).to eq("")
55
+ expect(stdout).to include("cip-12345")
56
+ expect(stdout).to include("New name")
57
+ end
58
+ end
59
+
60
+ context "--name ''" do
61
+ let(:new_name) { "" }
62
+ let(:expected_args) { ["cip-12345", { :name => "" }] }
63
+
64
+ before do
65
+ stub_request(:put, "http://api.brightbox.dev/1.0/cloud_ips/cip-12345?account_id=acc-12345")
66
+ .with(:headers => { "Content-Type" => "application/json" },
67
+ :body => hash_including("name" => ""))
68
+ .and_return(:status => 200, :body => json_response)
69
+
70
+ stub_request(:get, "http://api.brightbox.dev/1.0/cloud_ips/cip-12345?account_id=acc-12345")
71
+ .with(:headers => { "Content-Type" => "application/json" })
72
+ .and_return(:status => 200, :body => json_response)
73
+ end
74
+
75
+ it "puts new name in update" do
76
+ expect(Brightbox::CloudIP.conn).to receive(:update_cloud_ip).with(*expected_args).and_call_original
77
+ expect(stderr).to eq("")
78
+ expect(stdout).to include("cip-12345")
79
+ end
80
+ end
81
+ end
17
82
  end
18
83
  end
@@ -7,6 +7,11 @@ describe "brightbox lbs" do
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
+ before do
11
+ config = config_from_contents(USER_APP_CONFIG_CONTENTS)
12
+ cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
13
+ end
14
+
10
15
  context "" do
11
16
  let(:argv) { %w(lbs create) }
12
17
 
@@ -14,5 +19,31 @@ describe "brightbox lbs" do
14
19
  expect { output }.to_not raise_error
15
20
  end
16
21
  end
22
+
23
+ context "--ssl-min-ver=TLSv1.0" do
24
+ let(:argv) { ["lbs", "create", "--ssl-min-ver", "TLSv1.0", "srv-12345"] }
25
+ let(:expected_args) { { ssl_minimum_version: "TLSv1.0" } }
26
+
27
+ let(:json_response) do
28
+ <<-EOS
29
+ {
30
+ "id":"lba-12345",
31
+ "ssl_minimum_version":"TLSv1.0"
32
+ }
33
+ EOS
34
+ end
35
+
36
+ before do
37
+ stub_request(:post, "http://api.brightbox.dev/1.0/load_balancers?account_id=acc-12345")
38
+ .with(:body => hash_including("ssl_minimum_version" => "TLSv1.0"))
39
+ .to_return(:status => 202, :body => json_response)
40
+ end
41
+
42
+ it "includes ssl_minimum_version in response" do
43
+ expect(Brightbox::LoadBalancer).to receive(:create).with(hash_including(expected_args)).and_call_original
44
+ expect(stderr).to eq("Creating a new load balancer\n")
45
+ expect(stdout).to include("lba-12345")
46
+ end
47
+ end
17
48
  end
18
49
  end
@@ -7,6 +7,11 @@ describe "brightbox lbs" do
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
+ before do
11
+ config = config_from_contents(USER_APP_CONFIG_CONTENTS)
12
+ cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
13
+ end
14
+
10
15
  context "" do
11
16
  let(:argv) { %w(lbs update) }
12
17
 
@@ -14,5 +19,32 @@ describe "brightbox lbs" do
14
19
  expect { output }.to_not raise_error
15
20
  end
16
21
  end
22
+
23
+ context "--ssl-min-ver=TLSv1.0" do
24
+ let(:argv) { ["lbs", "update", "--ssl-min-ver", "TLSv1.0", "lba-12345"] }
25
+
26
+ let(:json_response) do
27
+ <<-EOS
28
+ {
29
+ "id":"lba-12345",
30
+ "ssl_minimum_version":"TLSv1.0"
31
+ }
32
+ EOS
33
+ end
34
+
35
+ before do
36
+ stub_request(:get, "http://api.brightbox.dev/1.0/load_balancers/lba-12345?account_id=acc-12345")
37
+ .to_return(:status => 200, :body => '{"id":"lba-12345"}')
38
+
39
+ stub_request(:put, "http://api.brightbox.dev/1.0/load_balancers/lba-12345?account_id=acc-12345")
40
+ .with(:body => hash_including("ssl_minimum_version" => "TLSv1.0"))
41
+ .to_return(:status => 202, :body => json_response)
42
+ end
43
+
44
+ it "includes ssl_minimum_version in response" do
45
+ expect(stderr).to eq("Updating load balancer lba-12345\n")
46
+ expect(stdout).to include("lba-12345")
47
+ end
48
+ end
17
49
  end
18
50
  end
@@ -7,6 +7,10 @@ describe "brightbox servers" do
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
+ let(:image) { double(:id => "img-12345", :name => "Linux") }
11
+ let(:type) { double(:id => "typ-12345", :handle => "nano") }
12
+ let(:zone) { double(:handle => "gb1-a") }
13
+
10
14
  before do
11
15
  config = config_from_contents(USER_APP_CONFIG_CONTENTS)
12
16
  cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
@@ -27,10 +31,6 @@ describe "brightbox servers" do
27
31
  context "with --cloud-ip with nominated IP argument" do
28
32
  let(:argv) { %w(servers create --cloud-ip cip-12345 img-12345) }
29
33
 
30
- let(:image) { double(:id => "img-12345", :name => "Linux") }
31
- let(:type) { double(:id => "typ-12345", :handle => "nano") }
32
- let(:zone) { double(:handle => "gb1-a") }
33
-
34
34
  before do
35
35
  expect(Brightbox::Image).to receive(:find).with("img-12345").and_return(image)
36
36
  expect(Brightbox::Type).to receive(:find_by_handle).and_return(type)
@@ -50,10 +50,6 @@ describe "brightbox servers" do
50
50
  context "with --cloud-ip true argument" do
51
51
  let(:argv) { %w(servers create --cloud-ip true img-12345) }
52
52
 
53
- let(:image) { double(:id => "img-12345", :name => "Linux") }
54
- let(:type) { double(:id => "typ-12345", :handle => "nano") }
55
- let(:zone) { double(:handle => "gb1-a") }
56
-
57
53
  before do
58
54
  expect(Brightbox::Image).to receive(:find).with("img-12345").and_return(image)
59
55
  expect(Brightbox::Type).to receive(:find_by_handle).and_return(type)
@@ -70,6 +66,26 @@ describe "brightbox servers" do
70
66
  end
71
67
  end
72
68
 
69
+ context "with --disk-encrypted switch" do
70
+ let(:argv) { %w(servers create --disk-encrypted img-12345) }
71
+
72
+ before do
73
+ expect(Brightbox::Image).to receive(:find).with("img-12345").and_return(image)
74
+ expect(Brightbox::Type).to receive(:find_by_handle).and_return(type)
75
+ end
76
+
77
+ it "requests new server with encryption at rest enabled" do
78
+ stub_request(:post, "http://api.brightbox.dev/1.0/servers?account_id=acc-12345")
79
+ .with(:headers => { "Content-Type" => "application/json" },
80
+ :body => hash_including(:disk_encrypted => true))
81
+ .and_return(:status => 202, :body => sample_response)
82
+
83
+ expect(stderr).to match("Creating a nano")
84
+ expect(stderr).not_to match("ERROR")
85
+ expect(stdout).to match("srv-12345")
86
+ end
87
+ end
88
+
73
89
  def sample_response
74
90
  '{
75
91
  "id": "srv-12345",
@@ -104,6 +104,32 @@ describe "brightbox sql instances" do
104
104
  end
105
105
  end
106
106
 
107
+ context "--snapshot=dbi-1493j" do
108
+ let(:argv) { ["sql", "instances", "create", "--snapshot=dbi-1493j"] }
109
+ let(:expected_args) { { :snapshot_id => "dbi-1493j" } }
110
+
111
+ let(:json_response) do
112
+ <<-EOS
113
+ {
114
+ "id":"dbs-12345"
115
+ }
116
+ EOS
117
+ end
118
+
119
+ before do
120
+ stub_request(:post, "http://api.brightbox.dev/1.0/database_servers?account_id=acc-12345")
121
+ .with(:headers => { "Content-Type" => "application/json" },
122
+ :body => hash_including("snapshot" => "dbi-1493j"))
123
+ .and_return(:status => 202, :body => json_response)
124
+ end
125
+
126
+ it "includes schedule fields in response" do
127
+ expect(Brightbox::DatabaseServer).to receive(:create).with(expected_args).and_call_original
128
+ expect(stdout).to include("id: dbs-12345")
129
+ expect(stderr).to eql("")
130
+ end
131
+ end
132
+
107
133
  context "--snapshots-schedule='0 12 * * 4'" do
108
134
  let(:argv) { ["sql", "instances", "create", "--snapshots-schedule=0 12 * * 4"] }
109
135
  let(:expected_args) { { :snapshots_schedule => "0 12 * * 4" } }
@@ -19,7 +19,7 @@ shared_context "collaborating accounts" do
19
19
  "load_balancers_limit" => 5,
20
20
  "load_balancers_used" => 0
21
21
  }
22
- Fog::Compute::Brightbox::Account.new(data)
22
+ Fog::Brightbox::Compute::Account.new(data)
23
23
  end
24
24
 
25
25
  # As returned from conn.user_collaborations.all
@@ -35,7 +35,7 @@ shared_context "collaborating accounts" do
35
35
  "status" => "active"
36
36
  }
37
37
  }
38
- Fog::Compute::Brightbox::UserCollaboration.new(data)
38
+ Fog::Brightbox::Compute::UserCollaboration.new(data)
39
39
  end
40
40
 
41
41
  # As returned from conn.user_collaborations.all
@@ -51,6 +51,6 @@ shared_context "collaborating accounts" do
51
51
  "status" => "active"
52
52
  }
53
53
  }
54
- Fog::Compute::Brightbox::UserCollaboration.new(data)
54
+ Fog::Brightbox::Compute::UserCollaboration.new(data)
55
55
  end
56
56
  end
@@ -13,7 +13,7 @@ describe Brightbox::Account do
13
13
  expect(Brightbox::Account.all).to be_kind_of(Array)
14
14
 
15
15
  Brightbox::Account.all.each do |account|
16
- expect(account).to be_kind_of(Fog::Compute::Brightbox::Account)
16
+ expect(account).to be_kind_of(Fog::Brightbox::Compute::Account)
17
17
  end
18
18
  end
19
19
 
@@ -31,7 +31,7 @@ describe Brightbox::Account do
31
31
  expect(Brightbox::Account.all).to be_kind_of(Array)
32
32
 
33
33
  Brightbox::Account.all.each do |account|
34
- expect(account).to be_kind_of(Fog::Compute::Brightbox::Account)
34
+ expect(account).to be_kind_of(Fog::Brightbox::Compute::Account)
35
35
  end
36
36
  end
37
37
 
@@ -18,7 +18,7 @@ describe Brightbox::Account do
18
18
  end
19
19
 
20
20
  it "returns requested account" do
21
- expect(@account).to be_kind_of(Fog::Compute::Brightbox::Account)
21
+ expect(@account).to be_kind_of(Fog::Brightbox::Compute::Account)
22
22
  expect(@account.id).to eql(@account_id)
23
23
  end
24
24
 
@@ -46,7 +46,7 @@ describe Brightbox::Account do
46
46
  end
47
47
 
48
48
  it "returns the client's owning account" do
49
- expect(@account).to be_kind_of(Fog::Compute::Brightbox::Account)
49
+ expect(@account).to be_kind_of(Fog::Brightbox::Compute::Account)
50
50
  expect(@account.id).to eql(@account_id)
51
51
  end
52
52
 
@@ -7,7 +7,7 @@ describe Brightbox::Api, ".conn" do
7
7
 
8
8
  context "when account is not required", vcr: true do
9
9
  it "returns a 'real' fog compute instance" do
10
- expect(Brightbox::Api.conn).to be_instance_of(Fog::Compute::Brightbox::Real)
10
+ expect(Brightbox::Api.conn).to be_instance_of(Fog::Brightbox::Compute::Real)
11
11
  end
12
12
  end
13
13
  end
@@ -5,7 +5,7 @@ describe Brightbox::CollaboratingAccount do
5
5
  data = {
6
6
  "id" => "acc-12345"
7
7
  }
8
- account_model = Fog::Compute::Brightbox::Account.new(data)
8
+ account_model = Fog::Brightbox::Compute::Account.new(data)
9
9
  Brightbox::CollaboratingAccount.new(account_model)
10
10
  end
11
11
 
@@ -19,7 +19,7 @@ describe Brightbox::ConnectionManager, "#fetch_connection" do
19
19
 
20
20
  context "when not requesting a scoped connection" do
21
21
  it "returns a fog compute instance" do
22
- expect(connection_manager.fetch_connection(false)).to be_kind_of(Fog::Compute::Brightbox::Real)
22
+ expect(connection_manager.fetch_connection(false)).to be_kind_of(Fog::Brightbox::Compute::Real)
23
23
  end
24
24
 
25
25
  it "returns a connection without account scope" do
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
  require "fog/brightbox/models/compute/database_server"
3
3
 
4
4
  describe Brightbox::DatabaseServer, "#cloud_ips" do
5
- let(:fog_model) { Fog::Compute::Brightbox::DatabaseServer.new(fog_settings) }
5
+ let(:fog_model) { Fog::Brightbox::Compute::DatabaseServer.new(fog_settings) }
6
6
  let(:dbs) { described_class.new(fog_model) }
7
7
 
8
8
  context "when attribute is missing" do
@@ -4,7 +4,7 @@ require "fog/brightbox/models/compute/database_server"
4
4
  describe Brightbox::DatabaseServer do
5
5
 
6
6
  describe "#maintenance_window" do
7
- let(:fog_model) { Fog::Compute::Brightbox::DatabaseServer.new(fog_settings) }
7
+ let(:fog_model) { Fog::Brightbox::Compute::DatabaseServer.new(fog_settings) }
8
8
  let(:dbs) { Brightbox::DatabaseServer.new(fog_model) }
9
9
 
10
10
  context "when default values" do
@@ -141,7 +141,7 @@ describe Brightbox::UserCollaboration do
141
141
  # Collection#load is private in fog so we can't just pass our collection
142
142
  # into get the correct object initialised.
143
143
  api_response_data.map do |datum|
144
- Fog::Compute::Brightbox::UserCollaboration.new(datum)
144
+ Fog::Brightbox::Compute::UserCollaboration.new(datum)
145
145
  end
146
146
  end
147
147
  end
@@ -52,6 +52,6 @@ describe Brightbox::UserCollaboration do
52
52
  "email_address" => "marie@example.com"
53
53
  }
54
54
  }
55
- Fog::Compute::Brightbox::UserCollaboration.new(api_response_data)
55
+ Fog::Brightbox::Compute::UserCollaboration.new(api_response_data)
56
56
  end
57
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightbox-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.2
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Leach
@@ -16,20 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.16.0
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '1.0'
19
+ version: 1.3.0
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: 0.16.0
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '1.0'
26
+ version: 1.3.0
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: fog-core
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -188,16 +182,16 @@ dependencies:
188
182
  name: rspec
189
183
  requirement: !ruby/object:Gem::Requirement
190
184
  requirements:
191
- - - "~>"
185
+ - - ">="
192
186
  - !ruby/object:Gem::Version
193
- version: '2.99'
187
+ version: '0'
194
188
  type: :development
195
189
  prerelease: false
196
190
  version_requirements: !ruby/object:Gem::Requirement
197
191
  requirements:
198
- - - "~>"
192
+ - - ">="
199
193
  - !ruby/object:Gem::Version
200
- version: '2.99'
194
+ version: '0'
201
195
  - !ruby/object:Gem::Dependency
202
196
  name: vcr
203
197
  requirement: !ruby/object:Gem::Requirement
@@ -247,6 +241,7 @@ executables:
247
241
  extensions: []
248
242
  extra_rdoc_files: []
249
243
  files:
244
+ - ".github/workflows/ruby.yml"
250
245
  - ".gitignore"
251
246
  - ".travis.yml"
252
247
  - CHANGELOG.md
@@ -763,7 +758,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
763
758
  requirements:
764
759
  - - ">="
765
760
  - !ruby/object:Gem::Version
766
- version: 1.9.3
761
+ version: '2.0'
767
762
  required_rubygems_version: !ruby/object:Gem::Requirement
768
763
  requirements:
769
764
  - - ">="