brightbox-cli 1.2.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/Gemfile +0 -2
- data/Gemfile.lock +25 -23
- data/Rakefile +1 -1
- data/bin/_brightbox-bash-completer +327 -328
- data/bin/brightbox +2 -2
- data/bin/brightbox-accounts +2 -2
- data/bin/brightbox-cloudips +2 -2
- data/bin/brightbox-config +2 -2
- data/bin/brightbox-firewall-policies +2 -2
- data/bin/brightbox-firewall-rules +2 -2
- data/bin/brightbox-groups +2 -2
- data/bin/brightbox-images +2 -2
- data/bin/brightbox-lbs +2 -2
- data/bin/brightbox-servers +2 -2
- data/bin/brightbox-types +2 -2
- data/bin/brightbox-users +2 -2
- data/bin/brightbox-zones +2 -2
- data/brightbox-cli.gemspec +14 -15
- data/lib/brightbox-cli/api.rb +4 -6
- data/lib/brightbox-cli/collaboration.rb +1 -3
- data/lib/brightbox-cli/commands/accounts/accept-invite.rb +1 -1
- data/lib/brightbox-cli/commands/accounts/default.rb +1 -1
- data/lib/brightbox-cli/commands/accounts/list.rb +1 -1
- data/lib/brightbox-cli/commands/accounts/remove.rb +1 -1
- data/lib/brightbox-cli/commands/accounts/reset-ftp-password.rb +1 -1
- data/lib/brightbox-cli/commands/accounts/show.rb +1 -1
- data/lib/brightbox-cli/commands/cloudips/create.rb +1 -1
- data/lib/brightbox-cli/commands/cloudips/destroy.rb +1 -1
- data/lib/brightbox-cli/commands/cloudips/list.rb +1 -1
- data/lib/brightbox-cli/commands/cloudips/show.rb +1 -1
- data/lib/brightbox-cli/commands/cloudips/unmap.rb +1 -1
- data/lib/brightbox-cli/commands/collaborations.rb +4 -4
- data/lib/brightbox-cli/commands/config/client-add.rb +1 -1
- data/lib/brightbox-cli/commands/config/client-default.rb +1 -1
- data/lib/brightbox-cli/commands/config/client-list.rb +1 -1
- data/lib/brightbox-cli/commands/config/client-remove.rb +1 -1
- data/lib/brightbox-cli/commands/config/user-add.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies-destroy.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies-list.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies-show.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/rules-destroy.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/rules-list.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/rules-show.rb +1 -1
- data/lib/brightbox-cli/commands/groups/add-server.rb +1 -1
- data/lib/brightbox-cli/commands/groups/create.rb +1 -1
- data/lib/brightbox-cli/commands/groups/destroy.rb +1 -1
- data/lib/brightbox-cli/commands/groups/list.rb +1 -1
- data/lib/brightbox-cli/commands/groups/show.rb +1 -1
- data/lib/brightbox-cli/commands/images/destroy.rb +1 -1
- data/lib/brightbox-cli/commands/images/locking.rb +37 -0
- data/lib/brightbox-cli/commands/images/register.rb +1 -1
- data/lib/brightbox-cli/commands/images/show.rb +18 -4
- data/lib/brightbox-cli/commands/lbs/add-nodes.rb +1 -1
- data/lib/brightbox-cli/commands/lbs/destroy.rb +1 -1
- data/lib/brightbox-cli/commands/lbs/list.rb +1 -1
- data/lib/brightbox-cli/commands/lbs/locking.rb +37 -0
- data/lib/brightbox-cli/commands/lbs/remove-nodes.rb +1 -1
- data/lib/brightbox-cli/commands/lbs/show.rb +3 -2
- data/lib/brightbox-cli/commands/servers/activate-console.rb +1 -1
- data/lib/brightbox-cli/commands/servers/destroy.rb +1 -1
- data/lib/brightbox-cli/commands/servers/locking.rb +37 -0
- data/lib/brightbox-cli/commands/servers/reboot.rb +20 -0
- data/lib/brightbox-cli/commands/servers/reset.rb +20 -0
- data/lib/brightbox-cli/commands/servers/show.rb +1 -1
- data/lib/brightbox-cli/commands/servers/shutdown.rb +1 -1
- data/lib/brightbox-cli/commands/servers/snapshot.rb +1 -1
- data/lib/brightbox-cli/commands/servers/start.rb +1 -1
- data/lib/brightbox-cli/commands/servers/stop.rb +1 -1
- data/lib/brightbox-cli/commands/sql/instances_create.rb +1 -1
- data/lib/brightbox-cli/commands/sql/instances_destroy.rb +1 -1
- data/lib/brightbox-cli/commands/sql/instances_list.rb +1 -1
- data/lib/brightbox-cli/commands/sql/instances_locking.rb +39 -0
- data/lib/brightbox-cli/commands/sql/instances_reset_password.rb +1 -1
- data/lib/brightbox-cli/commands/sql/instances_show.rb +1 -1
- data/lib/brightbox-cli/commands/sql/instances_snapshot.rb +1 -1
- data/lib/brightbox-cli/commands/sql/snapshots_destroy.rb +1 -1
- data/lib/brightbox-cli/commands/sql/snapshots_list.rb +1 -1
- data/lib/brightbox-cli/commands/sql/snapshots_locking.rb +39 -0
- data/lib/brightbox-cli/commands/sql/snapshots_show.rb +9 -2
- data/lib/brightbox-cli/commands/sql/types.rb +2 -2
- data/lib/brightbox-cli/commands/types.rb +2 -2
- data/lib/brightbox-cli/commands/user-collaborations.rb +2 -2
- data/lib/brightbox-cli/commands/users/list.rb +1 -1
- data/lib/brightbox-cli/commands/users/show.rb +1 -1
- data/lib/brightbox-cli/commands/zones.rb +1 -1
- data/lib/brightbox-cli/config/accounts.rb +1 -1
- data/lib/brightbox-cli/config/api_client.rb +3 -3
- data/lib/brightbox-cli/config/authentication_tokens.rb +2 -2
- data/lib/brightbox-cli/config/cache.rb +1 -1
- data/lib/brightbox-cli/config/dirty.rb +1 -1
- data/lib/brightbox-cli/config/user_application.rb +3 -3
- data/lib/brightbox-cli/config.rb +2 -2
- data/lib/brightbox-cli/database_server.rb +2 -1
- data/lib/brightbox-cli/database_snapshot.rb +1 -0
- data/lib/brightbox-cli/detailed_server.rb +1 -0
- data/lib/brightbox-cli/gli_global_hooks.rb +2 -2
- data/lib/brightbox-cli/images.rb +2 -1
- data/lib/brightbox-cli/legacy/args_adjuster.rb +3 -3
- data/lib/brightbox-cli/load_balancers.rb +1 -0
- data/lib/brightbox-cli/servers.rb +2 -1
- data/lib/brightbox-cli/user_collaboration.rb +1 -1
- data/lib/brightbox-cli/version.rb +1 -1
- data/lib/brightbox_cli.rb +3 -3
- data/locales/en.yml +24 -0
- data/spec/commands/accounts/default_spec.rb +2 -2
- data/spec/commands/accounts/list_spec.rb +7 -7
- data/spec/commands/accounts/reset_ftp_password_spec.rb +2 -2
- data/spec/commands/accounts/show_spec.rb +2 -2
- data/spec/commands/cloudips/create_spec.rb +2 -2
- data/spec/commands/cloudips/destroy_spec.rb +2 -2
- data/spec/commands/cloudips/list_spec.rb +2 -2
- data/spec/commands/cloudips/map_spec.rb +3 -3
- data/spec/commands/cloudips/show_spec.rb +2 -2
- data/spec/commands/cloudips/unmap_spec.rb +2 -2
- data/spec/commands/cloudips/update_spec.rb +2 -2
- data/spec/commands/config/client_add_spec.rb +2 -2
- data/spec/commands/config/client_default_spec.rb +2 -2
- data/spec/commands/config/client_list_spec.rb +2 -2
- data/spec/commands/config/client_remove_spec.rb +2 -2
- data/spec/commands/config/user_add_spec.rb +3 -6
- data/spec/commands/firewall_policies/update_spec.rb +7 -7
- data/spec/commands/groups/add_server_spec.rb +2 -2
- data/spec/commands/groups/create_spec.rb +2 -2
- data/spec/commands/groups/destroy_spec.rb +2 -2
- data/spec/commands/groups/list_spec.rb +2 -2
- data/spec/commands/groups/move_servers_spec.rb +2 -2
- data/spec/commands/groups/remove_servers_spec.rb +2 -2
- data/spec/commands/groups/show_spec.rb +2 -2
- data/spec/commands/groups/update_spec.rb +2 -2
- data/spec/commands/images/destroy_spec.rb +2 -2
- data/spec/commands/images/list_spec.rb +2 -2
- data/spec/commands/images/locking_spec.rb +73 -0
- data/spec/commands/images/register_spec.rb +2 -2
- data/spec/commands/images/show_spec.rb +2 -2
- data/spec/commands/images/update_spec.rb +2 -2
- data/spec/commands/lbs/add_nodes_spec.rb +2 -2
- data/spec/commands/lbs/create_spec.rb +2 -2
- data/spec/commands/lbs/destroy_spec.rb +2 -2
- data/spec/commands/lbs/list_spec.rb +2 -2
- data/spec/commands/lbs/locking_spec.rb +73 -0
- data/spec/commands/lbs/remove_nodes_spec.rb +2 -2
- data/spec/commands/lbs/show_spec.rb +2 -2
- data/spec/commands/lbs/update_spec.rb +2 -2
- data/spec/commands/policies/apply_spec.rb +2 -2
- data/spec/commands/policies/create_spec.rb +2 -2
- data/spec/commands/policies/destroy_spec.rb +2 -2
- data/spec/commands/policies/list_spec.rb +2 -2
- data/spec/commands/policies/remove_spec.rb +2 -2
- data/spec/commands/policies/show_spec.rb +2 -2
- data/spec/commands/policies/update_spec.rb +2 -2
- data/spec/commands/rules/create_spec.rb +2 -2
- data/spec/commands/rules/destroy_spec.rb +2 -2
- data/spec/commands/rules/list_spec.rb +2 -2
- data/spec/commands/rules/show_spec.rb +2 -2
- data/spec/commands/rules/update_spec.rb +2 -2
- data/spec/commands/servers/activate_console_spec.rb +2 -2
- data/spec/commands/servers/create_spec.rb +2 -2
- data/spec/commands/servers/destroy_spec.rb +2 -2
- data/spec/commands/servers/list_spec.rb +2 -2
- data/spec/commands/servers/locking_spec.rb +73 -0
- data/spec/commands/servers/reboot_spec.rb +55 -0
- data/spec/commands/servers/reset_spec.rb +55 -0
- data/spec/commands/servers/show_spec.rb +2 -2
- data/spec/commands/servers/shutdown_spec.rb +2 -2
- data/spec/commands/servers/snapshot_spec.rb +2 -2
- data/spec/commands/servers/start_spec.rb +2 -2
- data/spec/commands/servers/stop_spec.rb +2 -2
- data/spec/commands/servers/update_spec.rb +2 -2
- data/spec/commands/sql/instances/create_spec.rb +4 -4
- data/spec/commands/sql/instances/locking_spec.rb +73 -0
- data/spec/commands/sql/instances/snapshot_spec.rb +2 -2
- data/spec/commands/sql/snapshots/list_spec.rb +1 -1
- data/spec/commands/sql/snapshots/locking_spec.rb +73 -0
- data/spec/commands/sql/snapshots/show_spec.rb +1 -1
- data/spec/commands/sql/types/list_spec.rb +1 -1
- data/spec/commands/types/list_spec.rb +2 -2
- data/spec/commands/users/list_spec.rb +2 -2
- data/spec/commands/users/show_spec.rb +2 -2
- data/spec/commands/users/update_spec.rb +2 -2
- data/spec/commands/zones/list_spec.rb +2 -2
- data/spec/spec_helper.rb +8 -9
- data/spec/support/common_helpers.rb +10 -10
- data/spec/support/config_helpers.rb +0 -1
- data/spec/support/faux_io.rb +10 -14
- data/spec/support/password_prompt_helpers.rb +1 -2
- data/spec/support/server_helper.rb +1 -1
- data/spec/support/shared/api_resource_examples.rb +8 -8
- data/spec/support/shared/collaborating_accounts_context.rb +2 -2
- data/spec/support/shared/config_section_types.rb +2 -2
- data/spec/support/tmp_config.rb +4 -8
- data/spec/support/token_helpers.rb +1 -1
- data/spec/support/vcr.rb +1 -1
- data/spec/unit/brightbox/account/get_spec.rb +1 -1
- data/spec/unit/brightbox/account_spec.rb +3 -3
- data/spec/unit/brightbox/api/find_spec.rb +6 -6
- data/spec/unit/brightbox/api/require_account_spec.rb +1 -1
- data/spec/unit/brightbox/bb_config/account_spec.rb +3 -3
- data/spec/unit/brightbox/bb_config/clear_default_client_spec.rb +8 -8
- data/spec/unit/brightbox/bb_config/client_has_alias_spec.rb +3 -3
- data/spec/unit/brightbox/bb_config/client_name_spec.rb +5 -5
- data/spec/unit/brightbox/bb_config/client_named_spec.rb +6 -6
- data/spec/unit/brightbox/bb_config/config_directory_exists_spec.rb +3 -3
- data/spec/unit/brightbox/bb_config/config_spec.rb +5 -5
- data/spec/unit/brightbox/bb_config/default_account_spec.rb +6 -6
- data/spec/unit/brightbox/bb_config/default_client_spec.rb +2 -2
- data/spec/unit/brightbox/bb_config/find_or_set_default_account_spec.rb +14 -14
- data/spec/unit/brightbox/bb_config/has_multiple_clients_spec.rb +2 -2
- data/spec/unit/brightbox/bb_config/renew_tokens_spec.rb +4 -5
- data/spec/unit/brightbox/bb_config/save_spec.rb +2 -2
- data/spec/unit/brightbox/bb_config/to_fog_spec.rb +2 -2
- data/spec/unit/brightbox/bb_config/using_client_spec.rb +10 -10
- data/spec/unit/brightbox/collaborating_account/resource_type_spec.rb +4 -4
- data/spec/unit/brightbox/collaborating_account_spec.rb +3 -3
- data/spec/unit/brightbox/config/api_client/to_fog_spec.rb +2 -2
- data/spec/unit/brightbox/config/api_client/valid_spec.rb +5 -5
- data/spec/unit/brightbox/config/section_name_deduplicator_spec.rb +1 -1
- data/spec/unit/brightbox/config/to_fog_spec.rb +3 -3
- data/spec/unit/brightbox/config/user_application/to_fog_spec.rb +2 -2
- data/spec/unit/brightbox/config/user_application/valid_spec.rb +6 -6
- data/spec/unit/brightbox/connection_manager/fetch_connection_spec.rb +17 -17
- data/spec/unit/brightbox/firewall_policy/apply_to_spec.rb +3 -3
- data/spec/unit/brightbox/firewall_policy/create_spec.rb +5 -5
- data/spec/unit/brightbox/firewall_policy/destroy_spec.rb +4 -4
- data/spec/unit/brightbox/firewall_policy/find_or_call_spec.rb +1 -1
- data/spec/unit/brightbox/firewall_policy/find_spec.rb +1 -1
- data/spec/unit/brightbox/firewall_rule/create_spec.rb +1 -1
- data/spec/unit/brightbox/firewall_rule/destroy_spec.rb +2 -2
- data/spec/unit/brightbox/firewall_rule/find_spec.rb +3 -3
- data/spec/unit/brightbox/firewall_rule/from_policy_spec.rb +2 -2
- data/spec/unit/brightbox/legacy/args_adjuster_spec.rb +12 -12
- data/spec/unit/brightbox/server/create_spec.rb +2 -2
- data/spec/unit/brightbox/server/destroy_spec.rb +3 -3
- data/spec/unit/brightbox/server/find_or_call_spec.rb +1 -1
- data/spec/unit/brightbox/server/shutdown_spec.rb +2 -4
- data/spec/unit/brightbox/server/start_spec.rb +4 -4
- data/spec/unit/brightbox/server/stop_spec.rb +2 -4
- data/spec/unit/brightbox/server/update_spec.rb +2 -2
- data/spec/unit/brightbox/server_group/find_spec.rb +1 -1
- data/spec/unit/brightbox/user_collaboration/get_for_account_spec.rb +4 -4
- data/spec/unit/brightbox/user_collaboration/remove_spec.rb +11 -11
- data/spec/unit/nilable_hash_spec.rb +6 -6
- data/spec/unit/tmp_config_spec.rb +1 -1
- metadata +67 -31
@@ -7,55 +7,55 @@ describe Brightbox::Legacy::ArgsAdjuster do
|
|
7
7
|
let(:adjuster) { Brightbox::Legacy::ArgsAdjuster.new(args) }
|
8
8
|
|
9
9
|
context "when account global switch is used" do
|
10
|
-
let(:args) {
|
10
|
+
let(:args) { %w(--account acc-12345 show srv-12345) }
|
11
11
|
|
12
12
|
it "inserts after global args" do
|
13
|
-
expected =
|
13
|
+
expected = %w(--account acc-12345 command show srv-12345)
|
14
14
|
expect(adjuster.for_command "command").to eql(expected)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
context "when client global switch is used" do
|
19
|
-
let(:args) {
|
19
|
+
let(:args) { %w(-c staging show srv-12345) }
|
20
20
|
|
21
21
|
it "inserts after global args" do
|
22
|
-
expected =
|
22
|
+
expected = %w(-c staging command show srv-12345)
|
23
23
|
expect(adjuster.for_command "command").to eql(expected)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
context "when simple global flag is used" do
|
28
|
-
let(:args) {
|
28
|
+
let(:args) { %w(--simple show srv-12345) }
|
29
29
|
|
30
30
|
it "inserts after global args" do
|
31
|
-
expected =
|
31
|
+
expected = %w(-s command show srv-12345)
|
32
32
|
expect(adjuster.for_command "command").to eql(expected)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
context "when insecure global switch is used" do
|
37
|
-
let(:args) {
|
37
|
+
let(:args) { %w(-k show srv-12345) }
|
38
38
|
|
39
39
|
it "inserts after global args" do
|
40
|
-
expected =
|
40
|
+
expected = %w(-k command show srv-12345)
|
41
41
|
expect(adjuster.for_command "command").to eql(expected)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
context "when many args are passed" do
|
46
|
-
let(:args) {
|
46
|
+
let(:args) { %w(-k --simple -c prod subcommand srv-12345) }
|
47
47
|
|
48
48
|
it "inserts after global args" do
|
49
|
-
expected =
|
49
|
+
expected = %w(-k -s -c prod command subcommand srv-12345)
|
50
50
|
expect(adjuster.for_command "command").to eql(expected)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
context "when no global args are used" do
|
55
|
-
let(:args) {
|
55
|
+
let(:args) { %w(show srv-12345) }
|
56
56
|
|
57
57
|
it "inserts at the front" do
|
58
|
-
expected =
|
58
|
+
expected = %w(command show srv-12345)
|
59
59
|
expect(adjuster.for_command "command").to eql(expected)
|
60
60
|
end
|
61
61
|
end
|
@@ -16,10 +16,10 @@ describe Brightbox::Server do
|
|
16
16
|
error = nil
|
17
17
|
begin
|
18
18
|
Brightbox::Server.create(options)
|
19
|
-
rescue
|
19
|
+
rescue => e
|
20
20
|
error = Brightbox::ErrorParser.new(e)
|
21
21
|
end
|
22
|
-
output = FauxIO.new { error.pretty_print
|
22
|
+
output = FauxIO.new { error.pretty_print }
|
23
23
|
expect(output.stderr).to match(/Account limit reached, please contact support for more information/i)
|
24
24
|
end
|
25
25
|
end
|
@@ -6,15 +6,15 @@ describe Brightbox::Server do
|
|
6
6
|
describe "#destroy" do
|
7
7
|
context "when server exists", :vcr do
|
8
8
|
it "should work" do
|
9
|
-
#FIXME Spec never actually calls destroy, just checks output of creation!!
|
9
|
+
# FIXME: Spec never actually calls destroy, just checks output of creation!!
|
10
10
|
|
11
11
|
type = Brightbox::Type.find_by_handle "nano"
|
12
12
|
|
13
|
-
options = server_params("wow",type)
|
13
|
+
options = server_params("wow", type)
|
14
14
|
@servers = Brightbox::Server.create_servers 1, options
|
15
15
|
|
16
16
|
output = FauxIO.new do
|
17
|
-
Brightbox
|
17
|
+
Brightbox.render_table(@servers, :vertical => true)
|
18
18
|
end
|
19
19
|
expect(output.stdout).to include("wow")
|
20
20
|
expect(output.stdout).to include("img-12345")
|
@@ -18,7 +18,7 @@ describe Brightbox::Server do
|
|
18
18
|
|
19
19
|
it "shows detailed attributes of a server" do
|
20
20
|
output = FauxIO.new do
|
21
|
-
Brightbox.render_table(@servers,
|
21
|
+
Brightbox.render_table(@servers, :vertical => true)
|
22
22
|
end
|
23
23
|
expect(output.stdout).to include("private_ips:")
|
24
24
|
expect(output.stdout).to include("ram:")
|
@@ -6,14 +6,12 @@ describe Brightbox::Server do
|
|
6
6
|
describe "#shutdown", :vcr do
|
7
7
|
it "should work" do
|
8
8
|
type = Brightbox::Type.find_by_handle "nano"
|
9
|
-
options = server_params("rspec_server_shutdown",type)
|
9
|
+
options = server_params("rspec_server_shutdown", type)
|
10
10
|
server = (Brightbox::Server.create_servers 1, options).first
|
11
11
|
|
12
12
|
server.fog_model.wait_for { ready? }
|
13
13
|
|
14
|
-
|
15
|
-
server.shutdown
|
16
|
-
}.should_not raise_error
|
14
|
+
expect { server.shutdown }.not_to raise_error
|
17
15
|
end
|
18
16
|
end
|
19
17
|
end
|
@@ -6,17 +6,17 @@ describe Brightbox::Server do
|
|
6
6
|
describe "#start", :vcr do
|
7
7
|
it "should work" do
|
8
8
|
type = Brightbox::Type.find_by_handle "nano"
|
9
|
-
options = server_params("rspec_server_start",type)
|
9
|
+
options = server_params("rspec_server_start", type)
|
10
10
|
server = (Brightbox::Server.create_servers 1, options).first
|
11
11
|
|
12
12
|
server.fog_model.wait_for { ready? }
|
13
13
|
|
14
|
-
|
14
|
+
expect {
|
15
15
|
server.stop
|
16
|
-
server.fog_model.wait_for { !
|
16
|
+
server.fog_model.wait_for { !ready? }
|
17
17
|
|
18
18
|
server.start
|
19
|
-
}.
|
19
|
+
}.not_to raise_error
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -6,14 +6,12 @@ describe Brightbox::Server do
|
|
6
6
|
describe "#stop", :vcr do
|
7
7
|
it "should work" do
|
8
8
|
type = Brightbox::Type.find_by_handle "nano"
|
9
|
-
options = server_params("rspec_server_stop",type)
|
9
|
+
options = server_params("rspec_server_stop", type)
|
10
10
|
server = (Brightbox::Server.create_servers 1, options).first
|
11
11
|
|
12
12
|
server.fog_model.wait_for { ready? }
|
13
13
|
|
14
|
-
|
15
|
-
server.stop
|
16
|
-
}.should_not raise_error
|
14
|
+
expect { server.stop }.not_to raise_error
|
17
15
|
end
|
18
16
|
end
|
19
17
|
end
|
@@ -10,14 +10,14 @@ describe Brightbox::Server do
|
|
10
10
|
:image_id => image_id
|
11
11
|
}
|
12
12
|
@server = Brightbox::Server.create(options)
|
13
|
-
@group = Brightbox::ServerGroup.create(
|
13
|
+
@group = Brightbox::ServerGroup.create(:name => "test")
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should update with group" do
|
17
17
|
@server.update(:server_groups => [@group.id])
|
18
18
|
@server.reload
|
19
19
|
|
20
|
-
expect(@server.server_groups).to
|
20
|
+
expect(@server.server_groups.size).to eql(1)
|
21
21
|
expect(@server.server_groups[0]["id"]).to eq(@group.id)
|
22
22
|
end
|
23
23
|
|
@@ -14,7 +14,7 @@ describe Brightbox::ServerGroup do
|
|
14
14
|
it "list server groups" do
|
15
15
|
server_groups = Brightbox::ServerGroup.find(:all)
|
16
16
|
output = FauxIO.new do
|
17
|
-
Brightbox.render_table(server_groups,{})
|
17
|
+
Brightbox.render_table(server_groups, {})
|
18
18
|
end
|
19
19
|
expect(output.stdout).to include(@group.id)
|
20
20
|
end
|
@@ -76,7 +76,7 @@ describe Brightbox::UserCollaboration do
|
|
76
76
|
"id" => "usr-54321",
|
77
77
|
"resource_type" => "user",
|
78
78
|
"url" => "https://api.gb1.brightbox.com/1.0/users/usr-54321",
|
79
|
-
"name"=>"Marie Halvorson",
|
79
|
+
"name" => "Marie Halvorson",
|
80
80
|
"email_address" => "marie@example.com"
|
81
81
|
}
|
82
82
|
},
|
@@ -103,7 +103,7 @@ describe Brightbox::UserCollaboration do
|
|
103
103
|
"id" => "usr-54321",
|
104
104
|
"resource_type" => "user",
|
105
105
|
"url" => "https://api.gb1.brightbox.com/1.0/users/usr-54321",
|
106
|
-
"name"=>"Marie Halvorson",
|
106
|
+
"name" => "Marie Halvorson",
|
107
107
|
"email_address" => "marie@example.com"
|
108
108
|
}
|
109
109
|
},
|
@@ -130,14 +130,14 @@ describe Brightbox::UserCollaboration do
|
|
130
130
|
"id" => "usr-54321",
|
131
131
|
"resource_type" => "user",
|
132
132
|
"url" => "https://api.gb1.brightbox.com/1.0/users/usr-54321",
|
133
|
-
"name"=>"Marie Halvorson",
|
133
|
+
"name" => "Marie Halvorson",
|
134
134
|
"email_address" => "marie@example.com"
|
135
135
|
}
|
136
136
|
}
|
137
137
|
]
|
138
138
|
# Collection#load is private in fog so we can't just pass our collection
|
139
139
|
# into get the correct object initialised.
|
140
|
-
api_response_data.
|
140
|
+
api_response_data.map do |datum|
|
141
141
|
Fog::Compute::Brightbox::UserCollaboration.new(datum)
|
142
142
|
end
|
143
143
|
end
|
@@ -24,7 +24,7 @@ describe Brightbox::UserCollaboration do
|
|
24
24
|
|
25
25
|
# Returns a fog model of a UserCollaboration to initialise a CLI model
|
26
26
|
#
|
27
|
-
def faux_collaboration_data(status,
|
27
|
+
def faux_collaboration_data(status, _options = {})
|
28
28
|
api_response_data = {
|
29
29
|
"id" => "col-12345",
|
30
30
|
"resource_type" => "collaboration",
|
@@ -39,17 +39,17 @@ describe Brightbox::UserCollaboration do
|
|
39
39
|
"user" => nil,
|
40
40
|
"account" => {
|
41
41
|
"id" => "acc-12345",
|
42
|
-
"resource_type"=>"account",
|
43
|
-
"url"=>"https://api.gb1.brightbox.com/1.0/accounts/acc-12345",
|
44
|
-
"name"=>"System account",
|
45
|
-
"status"=>"active"
|
42
|
+
"resource_type" => "account",
|
43
|
+
"url" => "https://api.gb1.brightbox.com/1.0/accounts/acc-12345",
|
44
|
+
"name" => "System account",
|
45
|
+
"status" => "active"
|
46
46
|
},
|
47
|
-
"inviter"=>{
|
48
|
-
"id"=>"usr-54321",
|
49
|
-
"resource_type"=>"user",
|
50
|
-
"url"=>"https://api.gb1.brightbox.com/1.0/users/usr-54321",
|
51
|
-
"name"=>"Marie Halvorson",
|
52
|
-
"email_address"=>"marie@example.com"
|
47
|
+
"inviter" => {
|
48
|
+
"id" => "usr-54321",
|
49
|
+
"resource_type" => "user",
|
50
|
+
"url" => "https://api.gb1.brightbox.com/1.0/users/usr-54321",
|
51
|
+
"name" => "Marie Halvorson",
|
52
|
+
"email_address" => "marie@example.com"
|
53
53
|
}
|
54
54
|
}
|
55
55
|
Fog::Compute::Brightbox::UserCollaboration.new(api_response_data)
|
@@ -9,20 +9,20 @@ describe NilableHash, "#nilify_blanks" do
|
|
9
9
|
|
10
10
|
it "should nilify all blank values" do
|
11
11
|
@blank_hash.nilify_blanks
|
12
|
-
@blank_hash[:b1].
|
13
|
-
@blank_hash['b2'].
|
12
|
+
expect(@blank_hash[:b1]).to be_nil
|
13
|
+
expect(@blank_hash['b2']).to be_nil
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should leave nils as nil" do
|
17
|
-
@blank_hash['nilval'].
|
17
|
+
expect(@blank_hash['nilval']).to be_nil
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should not nilify non blank values" do
|
21
|
-
@blank_hash[:present].
|
22
|
-
@blank_hash['another'].
|
21
|
+
expect(@blank_hash[:present]).to eq('value')
|
22
|
+
expect(@blank_hash['another']).to eq('another value')
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should respond true when sent #is_a?(Hash)" do
|
26
|
-
NilableHash.new.is_a?(Hash).
|
26
|
+
expect(NilableHash.new.is_a?(Hash)).to be true
|
27
27
|
end
|
28
28
|
end
|
@@ -8,7 +8,7 @@ describe TmpConfig do
|
|
8
8
|
|
9
9
|
@tmp_config = TmpConfig.new(file_contents)
|
10
10
|
tmp_config_file = File.join(@tmp_config.path, "config")
|
11
|
-
expect(File.
|
11
|
+
expect(File.exist?(tmp_config_file)).to be true
|
12
12
|
|
13
13
|
contents = File.read(tmp_config_file)
|
14
14
|
expect(contents).to eql(file_contents)
|
metadata
CHANGED
@@ -1,45 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brightbox-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Leach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: fog-brightbox
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: gli
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.9'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.9'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: i18n
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.25'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: multi_json
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,35 +81,35 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: highline
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '1.6'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '1.6'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: hirb
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '0.6'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '0.6'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: mocha
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
@@ -123,47 +123,61 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: pry
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rake
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: rspec
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
157
|
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: '2.
|
159
|
+
version: '2.99'
|
146
160
|
type: :development
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version: '2.
|
166
|
+
version: '2.99'
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
168
|
+
name: vcr
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
156
170
|
requirements:
|
157
|
-
- - "
|
171
|
+
- - "~>"
|
158
172
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
173
|
+
version: '2.5'
|
160
174
|
type: :development
|
161
175
|
prerelease: false
|
162
176
|
version_requirements: !ruby/object:Gem::Requirement
|
163
177
|
requirements:
|
164
|
-
- - "
|
178
|
+
- - "~>"
|
165
179
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
180
|
+
version: '2.5'
|
167
181
|
description: Scripts to interact with the Brightbox cloud API
|
168
182
|
email:
|
169
183
|
- john@brightbox.co.uk
|
@@ -255,6 +269,7 @@ files:
|
|
255
269
|
- lib/brightbox-cli/commands/groups/update.rb
|
256
270
|
- lib/brightbox-cli/commands/images/destroy.rb
|
257
271
|
- lib/brightbox-cli/commands/images/list.rb
|
272
|
+
- lib/brightbox-cli/commands/images/locking.rb
|
258
273
|
- lib/brightbox-cli/commands/images/register.rb
|
259
274
|
- lib/brightbox-cli/commands/images/show.rb
|
260
275
|
- lib/brightbox-cli/commands/images/update.rb
|
@@ -262,6 +277,7 @@ files:
|
|
262
277
|
- lib/brightbox-cli/commands/lbs/create.rb
|
263
278
|
- lib/brightbox-cli/commands/lbs/destroy.rb
|
264
279
|
- lib/brightbox-cli/commands/lbs/list.rb
|
280
|
+
- lib/brightbox-cli/commands/lbs/locking.rb
|
265
281
|
- lib/brightbox-cli/commands/lbs/remove-nodes.rb
|
266
282
|
- lib/brightbox-cli/commands/lbs/show.rb
|
267
283
|
- lib/brightbox-cli/commands/lbs/update.rb
|
@@ -269,6 +285,9 @@ files:
|
|
269
285
|
- lib/brightbox-cli/commands/servers/create.rb
|
270
286
|
- lib/brightbox-cli/commands/servers/destroy.rb
|
271
287
|
- lib/brightbox-cli/commands/servers/list.rb
|
288
|
+
- lib/brightbox-cli/commands/servers/locking.rb
|
289
|
+
- lib/brightbox-cli/commands/servers/reboot.rb
|
290
|
+
- lib/brightbox-cli/commands/servers/reset.rb
|
272
291
|
- lib/brightbox-cli/commands/servers/show.rb
|
273
292
|
- lib/brightbox-cli/commands/servers/shutdown.rb
|
274
293
|
- lib/brightbox-cli/commands/servers/snapshot.rb
|
@@ -278,12 +297,14 @@ files:
|
|
278
297
|
- lib/brightbox-cli/commands/sql/instances_create.rb
|
279
298
|
- lib/brightbox-cli/commands/sql/instances_destroy.rb
|
280
299
|
- lib/brightbox-cli/commands/sql/instances_list.rb
|
300
|
+
- lib/brightbox-cli/commands/sql/instances_locking.rb
|
281
301
|
- lib/brightbox-cli/commands/sql/instances_reset_password.rb
|
282
302
|
- lib/brightbox-cli/commands/sql/instances_show.rb
|
283
303
|
- lib/brightbox-cli/commands/sql/instances_snapshot.rb
|
284
304
|
- lib/brightbox-cli/commands/sql/instances_update.rb
|
285
305
|
- lib/brightbox-cli/commands/sql/snapshots_destroy.rb
|
286
306
|
- lib/brightbox-cli/commands/sql/snapshots_list.rb
|
307
|
+
- lib/brightbox-cli/commands/sql/snapshots_locking.rb
|
287
308
|
- lib/brightbox-cli/commands/sql/snapshots_show.rb
|
288
309
|
- lib/brightbox-cli/commands/sql/snapshots_update.rb
|
289
310
|
- lib/brightbox-cli/commands/sql/types.rb
|
@@ -453,6 +474,7 @@ files:
|
|
453
474
|
- spec/commands/groups/update_spec.rb
|
454
475
|
- spec/commands/images/destroy_spec.rb
|
455
476
|
- spec/commands/images/list_spec.rb
|
477
|
+
- spec/commands/images/locking_spec.rb
|
456
478
|
- spec/commands/images/register_spec.rb
|
457
479
|
- spec/commands/images/show_spec.rb
|
458
480
|
- spec/commands/images/update_spec.rb
|
@@ -460,6 +482,7 @@ files:
|
|
460
482
|
- spec/commands/lbs/create_spec.rb
|
461
483
|
- spec/commands/lbs/destroy_spec.rb
|
462
484
|
- spec/commands/lbs/list_spec.rb
|
485
|
+
- spec/commands/lbs/locking_spec.rb
|
463
486
|
- spec/commands/lbs/remove_nodes_spec.rb
|
464
487
|
- spec/commands/lbs/show_spec.rb
|
465
488
|
- spec/commands/lbs/update_spec.rb
|
@@ -479,6 +502,9 @@ files:
|
|
479
502
|
- spec/commands/servers/create_spec.rb
|
480
503
|
- spec/commands/servers/destroy_spec.rb
|
481
504
|
- spec/commands/servers/list_spec.rb
|
505
|
+
- spec/commands/servers/locking_spec.rb
|
506
|
+
- spec/commands/servers/reboot_spec.rb
|
507
|
+
- spec/commands/servers/reset_spec.rb
|
482
508
|
- spec/commands/servers/show_spec.rb
|
483
509
|
- spec/commands/servers/shutdown_spec.rb
|
484
510
|
- spec/commands/servers/snapshot_spec.rb
|
@@ -486,8 +512,10 @@ files:
|
|
486
512
|
- spec/commands/servers/stop_spec.rb
|
487
513
|
- spec/commands/servers/update_spec.rb
|
488
514
|
- spec/commands/sql/instances/create_spec.rb
|
515
|
+
- spec/commands/sql/instances/locking_spec.rb
|
489
516
|
- spec/commands/sql/instances/snapshot_spec.rb
|
490
517
|
- spec/commands/sql/snapshots/list_spec.rb
|
518
|
+
- spec/commands/sql/snapshots/locking_spec.rb
|
491
519
|
- spec/commands/sql/snapshots/show_spec.rb
|
492
520
|
- spec/commands/sql/types/list_spec.rb
|
493
521
|
- spec/commands/types/list_spec.rb
|
@@ -756,6 +784,7 @@ test_files:
|
|
756
784
|
- spec/commands/groups/update_spec.rb
|
757
785
|
- spec/commands/images/destroy_spec.rb
|
758
786
|
- spec/commands/images/list_spec.rb
|
787
|
+
- spec/commands/images/locking_spec.rb
|
759
788
|
- spec/commands/images/register_spec.rb
|
760
789
|
- spec/commands/images/show_spec.rb
|
761
790
|
- spec/commands/images/update_spec.rb
|
@@ -763,6 +792,7 @@ test_files:
|
|
763
792
|
- spec/commands/lbs/create_spec.rb
|
764
793
|
- spec/commands/lbs/destroy_spec.rb
|
765
794
|
- spec/commands/lbs/list_spec.rb
|
795
|
+
- spec/commands/lbs/locking_spec.rb
|
766
796
|
- spec/commands/lbs/remove_nodes_spec.rb
|
767
797
|
- spec/commands/lbs/show_spec.rb
|
768
798
|
- spec/commands/lbs/update_spec.rb
|
@@ -782,6 +812,9 @@ test_files:
|
|
782
812
|
- spec/commands/servers/create_spec.rb
|
783
813
|
- spec/commands/servers/destroy_spec.rb
|
784
814
|
- spec/commands/servers/list_spec.rb
|
815
|
+
- spec/commands/servers/locking_spec.rb
|
816
|
+
- spec/commands/servers/reboot_spec.rb
|
817
|
+
- spec/commands/servers/reset_spec.rb
|
785
818
|
- spec/commands/servers/show_spec.rb
|
786
819
|
- spec/commands/servers/shutdown_spec.rb
|
787
820
|
- spec/commands/servers/snapshot_spec.rb
|
@@ -789,8 +822,10 @@ test_files:
|
|
789
822
|
- spec/commands/servers/stop_spec.rb
|
790
823
|
- spec/commands/servers/update_spec.rb
|
791
824
|
- spec/commands/sql/instances/create_spec.rb
|
825
|
+
- spec/commands/sql/instances/locking_spec.rb
|
792
826
|
- spec/commands/sql/instances/snapshot_spec.rb
|
793
827
|
- spec/commands/sql/snapshots/list_spec.rb
|
828
|
+
- spec/commands/sql/snapshots/locking_spec.rb
|
794
829
|
- spec/commands/sql/snapshots/show_spec.rb
|
795
830
|
- spec/commands/sql/types/list_spec.rb
|
796
831
|
- spec/commands/types/list_spec.rb
|
@@ -906,3 +941,4 @@ test_files:
|
|
906
941
|
- spec/unit/ruby_core_ext_spec.rb
|
907
942
|
- spec/unit/temporary_home_spec.rb
|
908
943
|
- spec/unit/tmp_config_spec.rb
|
944
|
+
has_rdoc:
|