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
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
describe "brightbox rules" do
|
4
4
|
|
5
5
|
describe "update" do
|
6
|
-
let(:output) { FauxIO.new { Brightbox
|
6
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
7
7
|
let(:stdout) { output.stdout }
|
8
8
|
let(:stderr) { output.stderr }
|
9
9
|
|
10
10
|
context "" do
|
11
|
-
let(:argv) {
|
11
|
+
let(:argv) { %w(rules update) }
|
12
12
|
|
13
13
|
it "does not error" do
|
14
14
|
expect { output }.to_not raise_error
|
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
describe "brightbox servers" do
|
4
4
|
|
5
5
|
describe "activate_console" do
|
6
|
-
let(:output) { FauxIO.new { Brightbox
|
6
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
7
7
|
let(:stdout) { output.stdout }
|
8
8
|
let(:stderr) { output.stderr }
|
9
9
|
|
10
10
|
context "" do
|
11
|
-
let(:argv) {
|
11
|
+
let(:argv) { %w(servers activate_console) }
|
12
12
|
|
13
13
|
it "does not error" do
|
14
14
|
expect { output }.to_not raise_error
|
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
describe "brightbox servers" do
|
4
4
|
|
5
5
|
describe "create" do
|
6
|
-
let(:output) { FauxIO.new { Brightbox
|
6
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
7
7
|
let(:stdout) { output.stdout }
|
8
8
|
let(:stderr) { output.stderr }
|
9
9
|
|
10
10
|
context "" do
|
11
|
-
let(:argv) {
|
11
|
+
let(:argv) { %w(servers create) }
|
12
12
|
|
13
13
|
it "does not error" do
|
14
14
|
expect { output }.to_not raise_error
|
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
describe "brightbox servers" do
|
4
4
|
|
5
5
|
describe "destroy" do
|
6
|
-
let(:output) { FauxIO.new { Brightbox
|
6
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
7
7
|
let(:stdout) { output.stdout }
|
8
8
|
let(:stderr) { output.stderr }
|
9
9
|
|
10
10
|
context "" do
|
11
|
-
let(:argv) {
|
11
|
+
let(:argv) { %w(servers destroy) }
|
12
12
|
|
13
13
|
it "does not error" do
|
14
14
|
expect { output }.to_not raise_error
|
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
describe "brightbox servers" do
|
4
4
|
|
5
5
|
describe "list" do
|
6
|
-
let(:output) { FauxIO.new { Brightbox
|
6
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
7
7
|
let(:stdout) { output.stdout }
|
8
8
|
let(:stderr) { output.stderr }
|
9
9
|
|
10
10
|
context "" do
|
11
|
-
let(:argv) {
|
11
|
+
let(:argv) { %w(servers list) }
|
12
12
|
|
13
13
|
it "does not error" do
|
14
14
|
expect { output }.to_not raise_error
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "brightbox servers" do
|
4
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
5
|
+
let(:stdout) { output.stdout }
|
6
|
+
let(:stderr) { output.stderr }
|
7
|
+
|
8
|
+
let(:resource_class) { Brightbox::Server }
|
9
|
+
let(:resource_id) { "srv-12345" }
|
10
|
+
let(:resource) { double(resource_class, :to_s => resource_id) }
|
11
|
+
|
12
|
+
let(:resource_ids) { [resource_id] }
|
13
|
+
let(:results) { [resource] }
|
14
|
+
|
15
|
+
before do
|
16
|
+
config = config_from_contents(USER_APP_CONFIG_CONTENTS)
|
17
|
+
cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "lock" do
|
21
|
+
context "when resource is known" do
|
22
|
+
let(:argv) { %w(servers lock srv-12345) }
|
23
|
+
|
24
|
+
before do
|
25
|
+
expect(resource_class).to receive(:find_or_call).with(resource_ids).and_return(results)
|
26
|
+
expect(resource).to receive(:lock!)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "outputs notice to STDERR" do
|
30
|
+
expect(stderr).to match("Locking #{resource_id}")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "when resource is unknown" do
|
35
|
+
let(:argv) { %w(servers lock srv-12345) }
|
36
|
+
|
37
|
+
before do
|
38
|
+
expect(resource_class).to receive(:find).with(resource_id).and_raise(Brightbox::Api::NotFound)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "outputs error to STDERR" do
|
42
|
+
expect(stderr).to match("Couldn't find #{resource_id}")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "unlock" do
|
48
|
+
context "when resource is known" do
|
49
|
+
let(:argv) { %w(servers unlock srv-12345) }
|
50
|
+
|
51
|
+
before do
|
52
|
+
expect(resource_class).to receive(:find_or_call).with(resource_ids).and_return(results)
|
53
|
+
expect(resource).to receive(:unlock!)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "outputs notice to STDERR" do
|
57
|
+
expect(stderr).to match("Unlocking #{resource_id}")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context "when resource is unknown" do
|
62
|
+
let(:argv) { %w(servers unlock srv-12345) }
|
63
|
+
|
64
|
+
before do
|
65
|
+
expect(resource_class).to receive(:find).with(resource_id).and_raise(Brightbox::Api::NotFound)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "outputs error to STDERR" do
|
69
|
+
expect(stderr).to match("Couldn't find #{resource_id}")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "brightbox servers" do
|
4
|
+
|
5
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
6
|
+
let(:stdout) { output.stdout }
|
7
|
+
let(:stderr) { output.stderr }
|
8
|
+
|
9
|
+
let(:resource_class) { Brightbox::Server }
|
10
|
+
let(:resource_id) { "srv-12345" }
|
11
|
+
let(:resource) { double(resource_class, :to_s => resource_id) }
|
12
|
+
|
13
|
+
let(:resource_ids) { [resource_id] }
|
14
|
+
let(:results) { [resource] }
|
15
|
+
|
16
|
+
before do
|
17
|
+
config = config_from_contents(USER_APP_CONFIG_CONTENTS)
|
18
|
+
cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "reboot" do
|
22
|
+
context "when resource is known" do
|
23
|
+
let(:argv) { %w(servers reboot srv-12345) }
|
24
|
+
|
25
|
+
before do
|
26
|
+
expect(resource_class).to receive(:find_or_call).with(resource_ids).and_return(results)
|
27
|
+
expect(resource).to receive(:reboot).with(false)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "outputs notice to STDERR" do
|
31
|
+
expect(stderr).to match("Sending reboot to #{resource_id}")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "when resource is unknown" do
|
36
|
+
let(:argv) { %w(servers reboot srv-12345) }
|
37
|
+
|
38
|
+
before do
|
39
|
+
expect(resource_class).to receive(:find).with(resource_id).and_raise(Brightbox::Api::NotFound)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "outputs error to STDERR" do
|
43
|
+
expect(stderr).to match("ERROR: Couldn't find #{resource_id}")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "when no arguments are passed" do
|
48
|
+
let(:argv) { %w(servers reboot) }
|
49
|
+
|
50
|
+
it "outputs error to STDERR" do
|
51
|
+
expect(stderr).to match("ERROR: You must specify servers to reboot")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "brightbox servers" do
|
4
|
+
|
5
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
6
|
+
let(:stdout) { output.stdout }
|
7
|
+
let(:stderr) { output.stderr }
|
8
|
+
|
9
|
+
let(:resource_class) { Brightbox::Server }
|
10
|
+
let(:resource_id) { "srv-12345" }
|
11
|
+
let(:resource) { double(resource_class, :to_s => resource_id) }
|
12
|
+
|
13
|
+
let(:resource_ids) { [resource_id] }
|
14
|
+
let(:results) { [resource] }
|
15
|
+
|
16
|
+
before do
|
17
|
+
config = config_from_contents(USER_APP_CONFIG_CONTENTS)
|
18
|
+
cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "reset" do
|
22
|
+
context "when resource is known" do
|
23
|
+
let(:argv) { %w(servers reset srv-12345) }
|
24
|
+
|
25
|
+
before do
|
26
|
+
expect(resource_class).to receive(:find_or_call).with(resource_ids).and_return(results)
|
27
|
+
expect(resource).to receive(:reboot).with(true)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "outputs notice to STDERR" do
|
31
|
+
expect(stderr).to match("Sending reset to #{resource_id}")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "when resource is unknown" do
|
36
|
+
let(:argv) { %w(servers reset srv-12345) }
|
37
|
+
|
38
|
+
before do
|
39
|
+
expect(resource_class).to receive(:find).with(resource_id).and_raise(Brightbox::Api::NotFound)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "outputs error to STDERR" do
|
43
|
+
expect(stderr).to match("ERROR: Couldn't find #{resource_id}")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "when no arguments are passed" do
|
48
|
+
let(:argv) { %w(servers reset) }
|
49
|
+
|
50
|
+
it "outputs error to STDERR" do
|
51
|
+
expect(stderr).to match("ERROR: You must specify servers to reset")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
describe "brightbox servers" do
|
4
4
|
|
5
5
|
describe "show" do
|
6
|
-
let(:output) { FauxIO.new { Brightbox
|
6
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
7
7
|
let(:stdout) { output.stdout }
|
8
8
|
let(:stderr) { output.stderr }
|
9
9
|
|
10
10
|
context "" do
|
11
|
-
let(:argv) {
|
11
|
+
let(:argv) { %w(servers show) }
|
12
12
|
|
13
13
|
it "does not error" do
|
14
14
|
expect { output }.to_not raise_error
|
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
describe "brightbox servers" do
|
4
4
|
|
5
5
|
describe "shutdown" do
|
6
|
-
let(:output) { FauxIO.new { Brightbox
|
6
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
7
7
|
let(:stdout) { output.stdout }
|
8
8
|
let(:stderr) { output.stderr }
|
9
9
|
|
10
10
|
context "" do
|
11
|
-
let(:argv) {
|
11
|
+
let(:argv) { %w(servers shutdown) }
|
12
12
|
|
13
13
|
it "does not error" do
|
14
14
|
expect { output }.to_not raise_error
|
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
describe "brightbox servers" do
|
4
4
|
|
5
5
|
describe "snapshot" do
|
6
|
-
let(:output) { FauxIO.new { Brightbox
|
6
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
7
7
|
let(:stdout) { output.stdout }
|
8
8
|
let(:stderr) { output.stderr }
|
9
9
|
|
10
10
|
context "" do
|
11
|
-
let(:argv) {
|
11
|
+
let(:argv) { %w(servers snapshot) }
|
12
12
|
|
13
13
|
it "does not error" do
|
14
14
|
expect { output }.to_not raise_error
|
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
describe "brightbox servers" do
|
4
4
|
|
5
5
|
describe "start" do
|
6
|
-
let(:output) { FauxIO.new { Brightbox
|
6
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
7
7
|
let(:stdout) { output.stdout }
|
8
8
|
let(:stderr) { output.stderr }
|
9
9
|
|
10
10
|
context "" do
|
11
|
-
let(:argv) {
|
11
|
+
let(:argv) { %w(servers start) }
|
12
12
|
|
13
13
|
it "does not error" do
|
14
14
|
expect { output }.to_not raise_error
|
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
describe "brightbox servers" do
|
4
4
|
|
5
5
|
describe "stop" do
|
6
|
-
let(:output) { FauxIO.new { Brightbox
|
6
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
7
7
|
let(:stdout) { output.stdout }
|
8
8
|
let(:stderr) { output.stderr }
|
9
9
|
|
10
10
|
context "" do
|
11
|
-
let(:argv) {
|
11
|
+
let(:argv) { %w(servers stop) }
|
12
12
|
|
13
13
|
it "does not error" do
|
14
14
|
expect { output }.to_not raise_error
|
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
describe "brightbox servers" do
|
4
4
|
|
5
5
|
describe "update" do
|
6
|
-
let(:output) { FauxIO.new { Brightbox
|
6
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
7
7
|
let(:stdout) { output.stdout }
|
8
8
|
let(:stderr) { output.stderr }
|
9
9
|
|
10
10
|
context "" do
|
11
|
-
let(:argv) {
|
11
|
+
let(:argv) { %w(servers update) }
|
12
12
|
|
13
13
|
it "does not error" do
|
14
14
|
expect { output }.to_not raise_error
|
@@ -14,7 +14,7 @@ describe "brightbox database-servers" do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
context "without arguments", :vcr do
|
17
|
-
let(:argv) { %w
|
17
|
+
let(:argv) { %w(sql instances create) }
|
18
18
|
let(:expected_password) { "477wwwj48yifrnuk" }
|
19
19
|
|
20
20
|
it "reports the new admin username" do
|
@@ -27,7 +27,7 @@ describe "brightbox database-servers" do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
context "--allow-access=10.0.0.0", :vcr do
|
30
|
-
let(:argv) { %w
|
30
|
+
let(:argv) { %w(sql instances create --allow-access=10.0.0.0) }
|
31
31
|
let(:expected_args) { { :allow_access => ["10.0.0.0"] } }
|
32
32
|
|
33
33
|
it "correctly sends API parameters" do
|
@@ -37,8 +37,8 @@ describe "brightbox database-servers" do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
context "--allow-access=srv-12345,grp-12345", :vcr do
|
40
|
-
let(:argv) { %w
|
41
|
-
let(:expected_args) { { :allow_access => %w
|
40
|
+
let(:argv) { %w(sql instances create --allow-access srv-12345,grp-12345) }
|
41
|
+
let(:expected_args) { { :allow_access => %w(srv-12345 grp-12345) } }
|
42
42
|
|
43
43
|
it "correctly sends API parameters" do
|
44
44
|
expect(Brightbox::DatabaseServer).to receive(:create).with(expected_args).and_call_original
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "brightbox sql instances" do
|
4
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
5
|
+
let(:stdout) { output.stdout }
|
6
|
+
let(:stderr) { output.stderr }
|
7
|
+
|
8
|
+
let(:resource_class) { Brightbox::DatabaseServer }
|
9
|
+
let(:resource_id) { "dbs-12345" }
|
10
|
+
let(:resource) { double(resource_class, :to_s => resource_id) }
|
11
|
+
|
12
|
+
let(:resource_ids) { [resource_id] }
|
13
|
+
let(:results) { [resource] }
|
14
|
+
|
15
|
+
before do
|
16
|
+
config = config_from_contents(USER_APP_CONFIG_CONTENTS)
|
17
|
+
cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "lock" do
|
21
|
+
context "when resource is known" do
|
22
|
+
let(:argv) { %w(sql instances lock dbs-12345) }
|
23
|
+
|
24
|
+
before do
|
25
|
+
expect(resource_class).to receive(:find_or_call).with(resource_ids).and_return(results)
|
26
|
+
expect(resource).to receive(:lock!)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "outputs notice to STDERR" do
|
30
|
+
expect(stderr).to match("Locking #{resource_id}")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "when resource is unknown" do
|
35
|
+
let(:argv) { %w(sql instances lock dbs-12345) }
|
36
|
+
|
37
|
+
before do
|
38
|
+
expect(resource_class).to receive(:find).with(resource_id).and_raise(Brightbox::Api::NotFound)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "outputs error to STDERR" do
|
42
|
+
expect(stderr).to match("Couldn't find #{resource_id}")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "unlock" do
|
48
|
+
context "when resource is known" do
|
49
|
+
let(:argv) { %w(sql instances unlock dbs-12345) }
|
50
|
+
|
51
|
+
before do
|
52
|
+
expect(resource_class).to receive(:find_or_call).with(resource_ids).and_return(results)
|
53
|
+
expect(resource).to receive(:unlock!)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "outputs notice to STDERR" do
|
57
|
+
expect(stderr).to match("Unlocking #{resource_id}")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context "when resource is unknown" do
|
62
|
+
let(:argv) { %w(sql instances unlock dbs-12345) }
|
63
|
+
|
64
|
+
before do
|
65
|
+
expect(resource_class).to receive(:find).with(resource_id).and_raise(Brightbox::Api::NotFound)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "outputs error to STDERR" do
|
69
|
+
expect(stderr).to match("Couldn't find #{resource_id}")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -14,7 +14,7 @@ describe "brightbox database-servers" do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
context "when database server active", :vcr do
|
17
|
-
let(:argv) { %w
|
17
|
+
let(:argv) { %w(sql instances snapshot dbs-12345) }
|
18
18
|
let(:expected_args) { { :allow_access => ["10.0.0.0"] } }
|
19
19
|
|
20
20
|
it "correctly sends API parameters" do
|
@@ -24,7 +24,7 @@ describe "brightbox database-servers" do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
context "when database server can not be snapshotted", :vcr do
|
27
|
-
let(:argv) { %w
|
27
|
+
let(:argv) { %w(sql instances snapshot dbs-12345) }
|
28
28
|
|
29
29
|
it "reports an error to the user" do
|
30
30
|
expect_any_instance_of(Brightbox::DatabaseServer).to receive(:snapshot).and_call_original
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "brightbox sql snapshots" do
|
4
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
5
|
+
let(:stdout) { output.stdout }
|
6
|
+
let(:stderr) { output.stderr }
|
7
|
+
|
8
|
+
let(:resource_class) { Brightbox::DatabaseSnapshot }
|
9
|
+
let(:resource_id) { "dbi-12345" }
|
10
|
+
let(:resource) { double(resource_class, :to_s => resource_id) }
|
11
|
+
|
12
|
+
let(:resource_ids) { [resource_id] }
|
13
|
+
let(:results) { [resource] }
|
14
|
+
|
15
|
+
before do
|
16
|
+
config = config_from_contents(USER_APP_CONFIG_CONTENTS)
|
17
|
+
cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "lock" do
|
21
|
+
context "when resource is known" do
|
22
|
+
let(:argv) { %w(sql snapshots lock dbi-12345) }
|
23
|
+
|
24
|
+
before do
|
25
|
+
expect(resource_class).to receive(:find_or_call).with(resource_ids).and_return(results)
|
26
|
+
expect(resource).to receive(:lock!)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "outputs notice to STDERR" do
|
30
|
+
expect(stderr).to match("Locking #{resource_id}")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "when resource is unknown" do
|
35
|
+
let(:argv) { %w(sql snapshots lock dbi-12345) }
|
36
|
+
|
37
|
+
before do
|
38
|
+
expect(resource_class).to receive(:find).with(resource_id).and_raise(Brightbox::Api::NotFound)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "outputs error to STDERR" do
|
42
|
+
expect(stderr).to match("Couldn't find #{resource_id}")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "unlock" do
|
48
|
+
context "when resource is known" do
|
49
|
+
let(:argv) { %w(sql snapshots unlock dbi-12345) }
|
50
|
+
|
51
|
+
before do
|
52
|
+
expect(resource_class).to receive(:find_or_call).with(resource_ids).and_return(results)
|
53
|
+
expect(resource).to receive(:unlock!)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "outputs notice to STDERR" do
|
57
|
+
expect(stderr).to match("Unlocking #{resource_id}")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context "when resource is unknown" do
|
62
|
+
let(:argv) { %w(sql snapshots unlock dbi-12345) }
|
63
|
+
|
64
|
+
before do
|
65
|
+
expect(resource_class).to receive(:find).with(resource_id).and_raise(Brightbox::Api::NotFound)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "outputs error to STDERR" do
|
69
|
+
expect(stderr).to match("Couldn't find #{resource_id}")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -14,7 +14,7 @@ describe "brightbox database-snapshots" do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
context "when resource exists", :vcr do
|
17
|
-
let(:argv) { %w
|
17
|
+
let(:argv) { %w(sql snapshots show dbi-12345) }
|
18
18
|
|
19
19
|
it "does not output to stderr" do
|
20
20
|
expect(stderr).to be_empty
|
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
describe "brightbox types" do
|
4
4
|
|
5
5
|
describe "list" do
|
6
|
-
let(:output) { FauxIO.new { Brightbox
|
6
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
7
7
|
let(:stdout) { output.stdout }
|
8
8
|
let(:stderr) { output.stderr }
|
9
9
|
|
10
10
|
context "" do
|
11
|
-
let(:argv) {
|
11
|
+
let(:argv) { %w(types list) }
|
12
12
|
|
13
13
|
it "does not error" do
|
14
14
|
expect { output }.to_not raise_error
|
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
describe "brightbox users" do
|
4
4
|
|
5
5
|
describe "list" do
|
6
|
-
let(:output) { FauxIO.new { Brightbox
|
6
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
7
7
|
let(:stdout) { output.stdout }
|
8
8
|
let(:stderr) { output.stderr }
|
9
9
|
|
10
10
|
context "" do
|
11
|
-
let(:argv) {
|
11
|
+
let(:argv) { %w(users list) }
|
12
12
|
|
13
13
|
it "does not error" do
|
14
14
|
expect { output }.to_not raise_error
|
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
describe "brightbox users" do
|
4
4
|
|
5
5
|
describe "show" do
|
6
|
-
let(:output) { FauxIO.new { Brightbox
|
6
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
7
7
|
let(:stdout) { output.stdout }
|
8
8
|
let(:stderr) { output.stderr }
|
9
9
|
|
10
10
|
context "" do
|
11
|
-
let(:argv) {
|
11
|
+
let(:argv) { %w(users show) }
|
12
12
|
|
13
13
|
it "does not error" do
|
14
14
|
expect { output }.to_not raise_error
|
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
describe "brightbox users" do
|
4
4
|
|
5
5
|
describe "update" do
|
6
|
-
let(:output) { FauxIO.new { Brightbox
|
6
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
7
7
|
let(:stdout) { output.stdout }
|
8
8
|
let(:stderr) { output.stderr }
|
9
9
|
|
10
10
|
context "" do
|
11
|
-
let(:argv) {
|
11
|
+
let(:argv) { %w(users update) }
|
12
12
|
|
13
13
|
it "does not error" do
|
14
14
|
expect { output }.to_not raise_error
|
@@ -3,12 +3,12 @@ require "spec_helper"
|
|
3
3
|
describe "brightbox zones" do
|
4
4
|
|
5
5
|
describe "list" do
|
6
|
-
let(:output) { FauxIO.new { Brightbox
|
6
|
+
let(:output) { FauxIO.new { Brightbox.run(argv) } }
|
7
7
|
let(:stdout) { output.stdout }
|
8
8
|
let(:stderr) { output.stderr }
|
9
9
|
|
10
10
|
context "" do
|
11
|
-
let(:argv) {
|
11
|
+
let(:argv) { %w(zones list) }
|
12
12
|
|
13
13
|
it "does not error" do
|
14
14
|
expect { output }.to_not raise_error
|