brightbox-cli 4.5.0 → 4.6.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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -1
  3. data/Gemfile.lock +2 -2
  4. data/lib/brightbox-cli/commands/accounts/show.rb +0 -2
  5. data/lib/brightbox-cli/commands/images/register.rb +2 -6
  6. data/lib/brightbox-cli/version.rb +1 -1
  7. data/locales/en.yml +0 -2
  8. data/spec/cassettes/Brightbox_Account/_all/when_connected_using_an_client/returns_a_collection_of_Accounts.yml +2 -2
  9. data/spec/cassettes/Brightbox_Account/_all/when_connected_using_an_client/returns_resources_on_the_same_connection.yml +1 -1
  10. data/spec/cassettes/Brightbox_BBConfig/_find_or_set_default_account/when_client_is_not_authenticated/does_not_raise_an_error.yml +1 -1
  11. data/spec/cassettes/Brightbox_BBConfig/_find_or_set_default_account/when_client_may_access_one_account/updates_the_setting.yml +1 -1
  12. data/spec/cassettes/Brightbox_CloudIP/_find_all_/when_a_Cloud_IP_exists/returns_a_suitable.yml +1 -1
  13. data/spec/cassettes/Brightbox_FirewallPolicy/_apply_to/should_apply_firewall_policy.yml +1 -1
  14. data/spec/cassettes/Brightbox_FirewallPolicy/_create/should_create_firewall_policy.yml +1 -1
  15. data/spec/cassettes/Brightbox_FirewallPolicy/_destroy/should_destroy_firewall_policy.yml +1 -1
  16. data/spec/cassettes/Brightbox_FirewallPolicy/_find_all_/when_a_policy_exists/should_list_firewall_policy.yml +1 -1
  17. data/spec/cassettes/Brightbox_FirewallPolicy/_find_or_call/when_a_policy_exists/should_show_firewall_policy.yml +1 -1
  18. data/spec/cassettes/Brightbox_FirewallRule/_create/when_policy_exists/creates_the_rule_successfully.yml +1 -1
  19. data/spec/cassettes/Brightbox_FirewallRule/_destroy/when_rule_exists/destroys_a_rule.yml +1 -1
  20. data/spec/cassettes/Brightbox_FirewallRule/_find/when_rule_exists/can_display_the_result.yml +1 -1
  21. data/spec/cassettes/Brightbox_FirewallRule/_from_policy/when_policy_exists_with_a_rule/lists_all_rules.yml +1 -1
  22. data/spec/cassettes/Brightbox_Server/_destroy/when_server_exists/should_work.yml +1 -1
  23. data/spec/cassettes/Brightbox_Server/_find_all_/when_a_server_exists/should_print_server_list.yml +1 -1
  24. data/spec/cassettes/Brightbox_Server/_show/when_server_exists/shows_detailed_attributes_of_a_server.yml +1 -1
  25. data/spec/cassettes/Brightbox_Server/_shutdown/should_work.yml +1 -1
  26. data/spec/cassettes/Brightbox_Server/_start/should_work.yml +1 -1
  27. data/spec/cassettes/Brightbox_Server/_stop/should_work.yml +1 -1
  28. data/spec/cassettes/Brightbox_Server/_update/when_passing_new_group_membership/should_update_with_group.yml +1 -1
  29. data/spec/cassettes/Brightbox_ServerGroup/_find_all_/when_a_group_exists/list_server_groups.yml +1 -1
  30. data/spec/cassettes/brightbox_accounts/list/does_not_error.yml +1 -1
  31. data/spec/cassettes/brightbox_config/client_add/when_adding_a_new_client/does_not_error.yml +1 -1
  32. data/spec/cassettes/brightbox_config/client_add/when_adding_a_new_client/sets_up_the_config.yml +1 -1
  33. data/spec/cassettes/brightbox_config/client_add/when_new_client_is_first_and_only_client/does_not_change_the_default_client.yml +1 -1
  34. data/spec/cassettes/brightbox_config/client_add/when_new_client_is_first_and_only_client/does_not_error.yml +1 -1
  35. data/spec/cassettes/brightbox_config/client_add/when_new_client_is_first_and_only_client/sets_this_as_the_default_client.yml +1 -1
  36. data/spec/cassettes/brightbox_config/client_add/when_new_client_is_first_and_only_client/sets_up_the_config.yml +1 -1
  37. data/spec/commands/images/register_spec.rb +5 -43
  38. metadata +1 -4
  39. data/lib/brightbox-cli/commands/accounts/reset_ftp_password.rb +0 -40
  40. data/spec/commands/accounts/reset_ftp_password_spec.rb +0 -17
@@ -78,7 +78,7 @@ http_interactions:
78
78
  Cache-Control:
79
79
  - max-age=0, private, must-revalidate
80
80
  body:
81
- string: "{\"id\":\"acc-12345\",\"resource_type\":\"account\",\"url\":\"https://api.gb1.brightbox.com/1.0/accounts/acc-12345\",\"name\":\"Aurnqfvgsbeyiprni\",\"status\":\"active\",\"address_1\":\"Kaycee Throughway\",\"address_2\":\"\",\"city\":\"South Hellenport\",\"county\":\"\",\"postcode\":\"60364-9886\",\"country_code\":\"GB\",\"country_name\":\"United Kingdom\",\"vat_registration_number\":\"\",\"telephone_number\":\"+444238318140\",\"telephone_verified\":false,\"verified_telephone\":null,\"verified_at\":null,\"verified_ip\":null,\"created_at\":\"2013-09-04T07:53:13Z\",\"ram_limit\":32768,\"ram_used\":0,\"cloud_ips_limit\":20,\"cloud_ips_used\":1,\"load_balancers_limit\":5,\"load_balancers_used\":0,\"valid_credit_card\":false,\"library_ftp_host\":\"ftp.library.gb1.brightbox.com\",\"library_ftp_user\":\"acc-12345\",\"library_ftp_password\":null,\"clients\":[{\"id\":\"cli-12345\",\"resource_type\":\"api_client\",\"url\":\"https://api.gb1.brightbox.com/1.0/api_clients/cli-12345\",\"name\":null,\"description\":null,\"revoked_at\":null}],\"images\":[],\"servers\":[],\"load_balancers\":[],\"cloud_ips\":[{\"id\":\"cip-12345\",\"resource_type\":\"cloud_ip\",\"url\":\"https://api.gb1.brightbox.com/1.0/cloud_ips/cip-12345\",\"status\":\"unmapped\",\"public_ip\":\"56.67.59.219\",\"reverse_dns\":\"cip-12345-67-59-219.gb1.brightbox.com\",\"name\":null}],\"server_groups\":[{\"id\":\"grp-12345\",\"resource_type\":\"server_group\",\"url\":\"https://api.gb1.brightbox.com/1.0/server_groups/grp-12345\",\"name\":\"default\",\"description\":\"All new servers are added to this group unless specified otherwise.\",\"created_at\":\"2013-09-04T07:53:13Z\",\"default\":true}],\"firewall_policies\":[{\"id\":\"fwp-12345\",\"resource_type\":\"firewall_policy\",\"url\":\"https://api.gb1.brightbox.com/1.0/firewall_policies/fwp-12345\",\"default\":true,\"name\":\"default\",\"created_at\":\"2013-09-04T07:53:14Z\",\"description\":\"Applied to the default server group.\"}],\"owner\":{\"id\":\"usr-12345\",\"resource_type\":\"user\",\"url\":\"https://api.gb1.brightbox.com/1.0/users/usr-12345\",\"name\":\"Dylan Fay DDS\",\"email_address\":\"jason.null@brightbox.com\"},\"users\":[],\"zones\":[{\"id\":\"zon-12345\",\"resource_type\":\"zone\",\"url\":\"https://api.gb1.brightbox.com/1.0/zones/zon-12345\",\"handle\":\"gb1-a\"},{\"id\":\"zon-12345\",\"resource_type\":\"zone\",\"url\":\"https://api.gb1.brightbox.com/1.0/zones/zon-12345\",\"handle\":\"gb1-b\"}]}"
81
+ string: "{\"id\":\"acc-12345\",\"resource_type\":\"account\",\"url\":\"https://api.gb1.brightbox.com/1.0/accounts/acc-12345\",\"name\":\"Aurnqfvgsbeyiprni\",\"status\":\"active\",\"address_1\":\"Kaycee Throughway\",\"address_2\":\"\",\"city\":\"South Hellenport\",\"county\":\"\",\"postcode\":\"60364-9886\",\"country_code\":\"GB\",\"country_name\":\"United Kingdom\",\"vat_registration_number\":\"\",\"telephone_number\":\"+444238318140\",\"telephone_verified\":false,\"verified_telephone\":null,\"verified_at\":null,\"verified_ip\":null,\"created_at\":\"2013-09-04T07:53:13Z\",\"ram_limit\":32768,\"ram_used\":0,\"cloud_ips_limit\":20,\"cloud_ips_used\":1,\"load_balancers_limit\":5,\"load_balancers_used\":0,\"valid_credit_card\":false,\"library_ftp_host\":\"\",\"library_ftp_user\":\"acc-12345\",\"library_ftp_password\":null,\"clients\":[{\"id\":\"cli-12345\",\"resource_type\":\"api_client\",\"url\":\"https://api.gb1.brightbox.com/1.0/api_clients/cli-12345\",\"name\":null,\"description\":null,\"revoked_at\":null}],\"images\":[],\"servers\":[],\"load_balancers\":[],\"cloud_ips\":[{\"id\":\"cip-12345\",\"resource_type\":\"cloud_ip\",\"url\":\"https://api.gb1.brightbox.com/1.0/cloud_ips/cip-12345\",\"status\":\"unmapped\",\"public_ip\":\"56.67.59.219\",\"reverse_dns\":\"cip-12345-67-59-219.gb1.brightbox.com\",\"name\":null}],\"server_groups\":[{\"id\":\"grp-12345\",\"resource_type\":\"server_group\",\"url\":\"https://api.gb1.brightbox.com/1.0/server_groups/grp-12345\",\"name\":\"default\",\"description\":\"All new servers are added to this group unless specified otherwise.\",\"created_at\":\"2013-09-04T07:53:13Z\",\"default\":true}],\"firewall_policies\":[{\"id\":\"fwp-12345\",\"resource_type\":\"firewall_policy\",\"url\":\"https://api.gb1.brightbox.com/1.0/firewall_policies/fwp-12345\",\"default\":true,\"name\":\"default\",\"created_at\":\"2013-09-04T07:53:14Z\",\"description\":\"Applied to the default server group.\"}],\"owner\":{\"id\":\"usr-12345\",\"resource_type\":\"user\",\"url\":\"https://api.gb1.brightbox.com/1.0/users/usr-12345\",\"name\":\"Dylan Fay DDS\",\"email_address\":\"jason.null@brightbox.com\"},\"users\":[],\"zones\":[{\"id\":\"zon-12345\",\"resource_type\":\"zone\",\"url\":\"https://api.gb1.brightbox.com/1.0/zones/zon-12345\",\"handle\":\"gb1-a\"},{\"id\":\"zon-12345\",\"resource_type\":\"zone\",\"url\":\"https://api.gb1.brightbox.com/1.0/zones/zon-12345\",\"handle\":\"gb1-b\"}]}"
82
82
  http_version:
83
83
  recorded_at: Fri, 06 Sep 2013 15:58:58 GMT
84
84
  - request:
@@ -29,18 +29,18 @@ describe "brightbox images" do
29
29
  it "does not error" do
30
30
  expect { output }.to_not raise_error
31
31
 
32
- expect(stderr).to match("ERROR: You must specify one of 'server', 'source', 'url', or 'volume'")
32
+ expect(stderr).to match("ERROR: You must specify one of 'server', 'url', or 'volume'")
33
33
  expect(stdout).to match("")
34
34
  end
35
35
  end
36
36
 
37
37
  context "with mutually exclusive arguments" do
38
- let(:argv) { %w[images register --arch x86_64 --source test.img --url http://example.com/test.img] }
38
+ let(:argv) { %w[images register --arch x86_64 --server srv-12345 --url http://example.com/test.img] }
39
39
 
40
40
  it "does not error" do
41
41
  expect { output }.to_not raise_error
42
42
 
43
- expect(stderr).to match("ERROR: You cannot register from multiple sources. Use either 'source', 'server', 'url', or 'volume'")
43
+ expect(stderr).to match("ERROR: You cannot register from multiple sources. Use either 'server', 'url', or 'volume'")
44
44
  expect(stdout).to match("")
45
45
  end
46
46
  end
@@ -83,44 +83,6 @@ describe "brightbox images" do
83
83
  end
84
84
  end
85
85
 
86
- context "with 'source' argument" do
87
- let(:argv) { %w[images register --arch x86_64 --source custom.img] }
88
-
89
- before do
90
- expect(Brightbox::Image).to receive(:register)
91
- .with(hash_including(
92
- arch: "x86_64",
93
- source: "custom.img"
94
- ))
95
- .and_call_original
96
-
97
- stub_request(:post, "#{api_url}/1.0/images?account_id=acc-12345")
98
- .with(body: /"source":"custom.img"/)
99
- .to_return(
100
- status: 201,
101
- body: {
102
- id: "img-12345"
103
- }.to_json
104
- )
105
-
106
- stub_request(:get, "#{api_url}/1.0/images/img-12345?account_id=acc-12345")
107
- .to_return(
108
- status: 200,
109
- body: {
110
- id: "img-12345"
111
- }.to_json
112
- )
113
- end
114
-
115
- it "does not error" do
116
- expect { output }.to_not raise_error
117
-
118
- expect(stderr).to match("")
119
- expect(stderr).not_to match("ERROR")
120
- expect(stdout).to match("img-12345")
121
- end
122
- end
123
-
124
86
  context "with 'url' argument" do
125
87
  let(:argv) { %w[images register --arch x86_64 --url https://example.com/os-22.iso] }
126
88
 
@@ -198,14 +160,14 @@ describe "brightbox images" do
198
160
  end
199
161
 
200
162
  context "with min-ram argument" do
201
- let(:argv) { %w[images register --arch x86_64 --source custom.img --min-ram 2048] }
163
+ let(:argv) { %w[images register --arch x86_64 --url https://example.com/os-22.iso --min-ram 2048] }
202
164
 
203
165
  before do
204
166
  expect(Brightbox::Image).to receive(:register)
205
167
  .with(hash_including(
206
168
  arch: "x86_64",
207
169
  min_ram: 2048,
208
- source: "custom.img"
170
+ http_url: "https://example.com/os-22.iso"
209
171
  ))
210
172
  .and_call_original
211
173
 
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: 4.5.0
4
+ version: 4.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Leach
@@ -303,7 +303,6 @@ files:
303
303
  - lib/brightbox-cli/commands/accounts/default.rb
304
304
  - lib/brightbox-cli/commands/accounts/list.rb
305
305
  - lib/brightbox-cli/commands/accounts/remove.rb
306
- - lib/brightbox-cli/commands/accounts/reset_ftp_password.rb
307
306
  - lib/brightbox-cli/commands/accounts/show.rb
308
307
  - lib/brightbox-cli/commands/cloudips/create.rb
309
308
  - lib/brightbox-cli/commands/cloudips/destroy.rb
@@ -588,7 +587,6 @@ files:
588
587
  - spec/cassettes/brightbox_sql_snapshots/show/when_resource_exists/does_not_output_to_stderr.yml
589
588
  - spec/commands/accounts/default_spec.rb
590
589
  - spec/commands/accounts/list_spec.rb
591
- - spec/commands/accounts/reset_ftp_password_spec.rb
592
590
  - spec/commands/accounts/show_spec.rb
593
591
  - spec/commands/cloudips/create_spec.rb
594
592
  - spec/commands/cloudips/destroy_spec.rb
@@ -957,7 +955,6 @@ test_files:
957
955
  - spec/cassettes/brightbox_sql_snapshots/show/when_resource_exists/does_not_output_to_stderr.yml
958
956
  - spec/commands/accounts/default_spec.rb
959
957
  - spec/commands/accounts/list_spec.rb
960
- - spec/commands/accounts/reset_ftp_password_spec.rb
961
958
  - spec/commands/accounts/show_spec.rb
962
959
  - spec/commands/cloudips/create_spec.rb
963
960
  - spec/commands/cloudips/destroy_spec.rb
@@ -1,40 +0,0 @@
1
- module Brightbox
2
- command [:accounts] do |cmd|
3
- cmd.desc I18n.t("accounts.reset_ftp_password.desc")
4
- cmd.arg_name "account-id..."
5
- cmd.command [:reset_ftp_password] do |c|
6
- c.action do |global_options, _options, args|
7
- if args.empty?
8
- raise "You must specify the accounts to reset ftp passwords for"
9
- end
10
-
11
- accounts = Account.find_or_call(args) do |id|
12
- raise "Couldn't find account #{id}"
13
- end
14
-
15
- rows = []
16
-
17
- accounts.each do |s|
18
- info "Resetting ftp password for #{s}"
19
- new_password = s.reset_ftp_password
20
- o = s.to_row
21
- o[:library_ftp_password] = new_password
22
- rows << o
23
- end
24
-
25
- table_opts = global_options.merge(
26
- :vertical => true,
27
- :fields => %i[
28
- id
29
- name
30
- library_ftp_host
31
- library_ftp_user
32
- library_ftp_password
33
- ]
34
- )
35
-
36
- render_table(rows, table_opts)
37
- end
38
- end
39
- end
40
- end
@@ -1,17 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "brightbox accounts" do
4
- describe "reset_ftp_password" do
5
- let(:output) { FauxIO.new { Brightbox.run(argv) } }
6
- let(:stdout) { output.stdout }
7
- let(:stderr) { output.stderr }
8
-
9
- context "" do
10
- let(:argv) { %w[accounts reset_ftp_password] }
11
-
12
- it "does not error" do
13
- expect { output }.to_not raise_error
14
- end
15
- end
16
- end
17
- end