brightbox-cli 3.0.0 → 3.0.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: 0c5b05513e19a2b2086a60adcdcc9db34da763ea57057fe3cd4565f13d996325
4
- data.tar.gz: 2330375316fccfb4681d2eafd793070821ac58e8af68d73c9b8370301a4ecd43
3
+ metadata.gz: 1cc8d372e2c0c019461ab6f5302f71d9a5241646d57cc91eaba2be3033794012
4
+ data.tar.gz: 95314299e02e4d28ea02467a00eb5093f7e74c9dbc561459ea892175edc08043
5
5
  SHA512:
6
- metadata.gz: a2b9f70e55d3ac5273a6179ff17bd10f5c99d75c628d67dfd671413d657717d34f00a8ecbbb1397b952b56ed34b55249e836c09417c32b69eebcb677877b941e
7
- data.tar.gz: de89095e13e79781b3c04828a4e20e1150056a4e3f838fa19923f949741c332cbeb4bb4b46b38566f2a7dc2b6e76b893cd658963b5194b33f7a79674cf650314
6
+ metadata.gz: e32fdba2d13ad2917a7200f5cba06223ec2fcf059dc3404685b790f81b64c009857e7f984e9c9a7e01f06d55db31f00820413c77ff1570ed5a934c78cc9c03a2
7
+ data.tar.gz: 1d7c5414f09b8b1ffba4a3a00792dacb5555b0b2da38da9044591d8ab6ddbcc36dcb7a35e700ad61a839f414f26f9b7d5fe04210221438e82b864eb5a607a3cc
@@ -1,3 +1,11 @@
1
+ ### v3.0.1 / 2020-07-01
2
+
3
+ [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v3.0.0...v3.0.1)
4
+
5
+ Bug fixes:
6
+
7
+ * Fix `cloudips update --name` to correctly set blank names
8
+
1
9
  ### v3.0.0 / 2020-07-01
2
10
 
3
11
  [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v2.12.0...v3.0.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brightbox-cli (3.0.0)
4
+ brightbox-cli (3.0.1)
5
5
  dry-inflector (< 0.2)
6
6
  fog-brightbox (>= 1.1.0)
7
7
  fog-core (< 2.0)
@@ -17,7 +17,7 @@ pipeline {
17
17
  }
18
18
  steps {
19
19
  sh 'bundle install --deployment'
20
- sh 'bundle exec rake test'
20
+ sh 'bundle exec rake spec'
21
21
  }
22
22
  }
23
23
  stage("Ruby 2.1") {
@@ -28,7 +28,7 @@ pipeline {
28
28
  }
29
29
  steps {
30
30
  sh 'bundle install --deployment'
31
- sh 'bundle exec rake test'
31
+ sh 'bundle exec rake spec'
32
32
  }
33
33
  }
34
34
  stage("Ruby 2.2") {
@@ -39,7 +39,7 @@ pipeline {
39
39
  }
40
40
  steps {
41
41
  sh 'bundle install --deployment'
42
- sh 'bundle exec rake test'
42
+ sh 'bundle exec rake spec'
43
43
  }
44
44
  }
45
45
  stage("Ruby 2.3") {
@@ -50,7 +50,7 @@ pipeline {
50
50
  }
51
51
  steps {
52
52
  sh 'bundle install --deployment'
53
- sh 'bundle exec rake test'
53
+ sh 'bundle exec rake spec'
54
54
  }
55
55
  }
56
56
  stage("Ruby 2.4") {
@@ -61,7 +61,7 @@ pipeline {
61
61
  }
62
62
  steps {
63
63
  sh 'bundle install --deployment'
64
- sh 'bundle exec rake test'
64
+ sh 'bundle exec rake spec'
65
65
  }
66
66
  }
67
67
  stage("Ruby 2.5") {
@@ -72,7 +72,7 @@ pipeline {
72
72
  }
73
73
  steps {
74
74
  sh 'bundle install --deployment'
75
- sh 'bundle exec rake test'
75
+ sh 'bundle exec rake spec'
76
76
  }
77
77
  }
78
78
  stage("Ruby 2.6") {
@@ -83,7 +83,7 @@ pipeline {
83
83
  }
84
84
  steps {
85
85
  sh 'bundle install --deployment'
86
- sh 'bundle exec rake test'
86
+ sh 'bundle exec rake spec'
87
87
  }
88
88
  }
89
89
  }
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Brightbox
2
- VERSION = "3.0.0" unless defined?(Brightbox::VERSION)
2
+ VERSION = "3.0.1" 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
@@ -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" } }
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: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Leach