brightbox-cli 1.2.2 → 1.3.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.
- 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
|
@@ -18,7 +18,7 @@ describe Brightbox::BBConfig do
|
|
|
18
18
|
EOS
|
|
19
19
|
end
|
|
20
20
|
it "is true" do
|
|
21
|
-
expect(config.has_multiple_clients?).to
|
|
21
|
+
expect(config.has_multiple_clients?).to be true
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -33,7 +33,7 @@ describe Brightbox::BBConfig do
|
|
|
33
33
|
EOS
|
|
34
34
|
end
|
|
35
35
|
it "is false" do
|
|
36
|
-
expect(config.has_multiple_clients?).to
|
|
36
|
+
expect(config.has_multiple_clients?).to be false
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
end
|
|
@@ -33,7 +33,7 @@ describe Brightbox::BBConfig do
|
|
|
33
33
|
|
|
34
34
|
it "caches the new tokens" do
|
|
35
35
|
# Access token
|
|
36
|
-
expect(File.
|
|
36
|
+
expect(File.exist?(@config.access_token_filename)).to be true
|
|
37
37
|
|
|
38
38
|
expect(cached_access_token(@config)).to eql(@new_access_token)
|
|
39
39
|
|
|
@@ -55,7 +55,6 @@ describe Brightbox::BBConfig do
|
|
|
55
55
|
@new_access_token = "0d09cf23393aeb039b7abe6fd15339108095e927"
|
|
56
56
|
@new_refresh_token = "53779449e94964eefb10daaa4807fd5f007b5211"
|
|
57
57
|
|
|
58
|
-
|
|
59
58
|
# If we are prompting then the refresh token has failed
|
|
60
59
|
expect(@config).to_not receive(:prompt_for_password)
|
|
61
60
|
@output = FauxIO.new { @config.renew_tokens }
|
|
@@ -63,7 +62,7 @@ describe Brightbox::BBConfig do
|
|
|
63
62
|
|
|
64
63
|
it "caches the new tokens" do
|
|
65
64
|
# Access token
|
|
66
|
-
expect(File.
|
|
65
|
+
expect(File.exist?(@config.access_token_filename)).to be true
|
|
67
66
|
|
|
68
67
|
# NOTE The cached to disk version is filtered by VCR when testing
|
|
69
68
|
expect(cached_access_token(@config)).to eql(@new_access_token)
|
|
@@ -91,7 +90,7 @@ describe Brightbox::BBConfig do
|
|
|
91
90
|
|
|
92
91
|
it "caches the new tokens" do
|
|
93
92
|
# Access token
|
|
94
|
-
expect(File.
|
|
93
|
+
expect(File.exist?(@config.access_token_filename)).to be true
|
|
95
94
|
|
|
96
95
|
# NOTE The cached to disk version is filtered by VCR when testing
|
|
97
96
|
expect(cached_access_token(@config)).to eql(@new_access_token)
|
|
@@ -112,7 +111,7 @@ describe Brightbox::BBConfig do
|
|
|
112
111
|
end
|
|
113
112
|
|
|
114
113
|
it "caches a new access token" do
|
|
115
|
-
expect(File.
|
|
114
|
+
expect(File.exist?(@config.access_token_filename)).to be true
|
|
116
115
|
expect(cached_access_token(@config)).to eql("5f3fd8fe25388fc9b801afc15a23d3991c68257d")
|
|
117
116
|
end
|
|
118
117
|
end
|
|
@@ -6,7 +6,7 @@ describe Brightbox::BBConfig do
|
|
|
6
6
|
let(:config) { Brightbox::BBConfig.new }
|
|
7
7
|
|
|
8
8
|
before do
|
|
9
|
-
Ini.
|
|
9
|
+
expect_any_instance_of(Ini).not_to receive(:write)
|
|
10
10
|
expect(config).to_not be_dirty
|
|
11
11
|
end
|
|
12
12
|
|
|
@@ -24,7 +24,7 @@ describe Brightbox::BBConfig do
|
|
|
24
24
|
let(:config) { Brightbox::BBConfig.new }
|
|
25
25
|
|
|
26
26
|
before do
|
|
27
|
-
Ini.
|
|
27
|
+
expect_any_instance_of(Ini).to receive(:write)
|
|
28
28
|
config.dirty!
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -29,9 +29,9 @@ describe Brightbox::BBConfig do
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
it "does not raise an error" do
|
|
32
|
-
expect
|
|
32
|
+
expect do
|
|
33
33
|
Brightbox::BBConfig.new.using_application?
|
|
34
|
-
|
|
34
|
+
end.to raise_error(Brightbox::NoSelectedClientError, error_message)
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -40,7 +40,7 @@ describe Brightbox::BBConfig do
|
|
|
40
40
|
|
|
41
41
|
it "returns true" do
|
|
42
42
|
config.client_name = client_name
|
|
43
|
-
expect(config.using_application?).to
|
|
43
|
+
expect(config.using_application?).to be true
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -49,7 +49,7 @@ describe Brightbox::BBConfig do
|
|
|
49
49
|
|
|
50
50
|
it "returns false" do
|
|
51
51
|
config.client_name = client_name
|
|
52
|
-
expect(config.using_application?).to
|
|
52
|
+
expect(config.using_application?).to be false
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
|
|
@@ -58,7 +58,7 @@ describe Brightbox::BBConfig do
|
|
|
58
58
|
|
|
59
59
|
it "returns true" do
|
|
60
60
|
config.client_name = client_name
|
|
61
|
-
expect(config.using_application?).to
|
|
61
|
+
expect(config.using_application?).to be true
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
end
|
|
@@ -70,9 +70,9 @@ describe Brightbox::BBConfig do
|
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
it "does not raise an error" do
|
|
73
|
-
expect
|
|
73
|
+
expect do
|
|
74
74
|
Brightbox::BBConfig.new.using_api_client?
|
|
75
|
-
|
|
75
|
+
end.to raise_error(Brightbox::NoSelectedClientError, error_message)
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
78
|
|
|
@@ -81,7 +81,7 @@ describe Brightbox::BBConfig do
|
|
|
81
81
|
|
|
82
82
|
it "returns false" do
|
|
83
83
|
config.client_name = client_name
|
|
84
|
-
expect(config.using_api_client?).to
|
|
84
|
+
expect(config.using_api_client?).to be false
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
|
|
@@ -90,7 +90,7 @@ describe Brightbox::BBConfig do
|
|
|
90
90
|
|
|
91
91
|
it "returns true" do
|
|
92
92
|
config.client_name = client_name
|
|
93
|
-
expect(config.using_api_client?).to
|
|
93
|
+
expect(config.using_api_client?).to be true
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
|
|
@@ -99,7 +99,7 @@ describe Brightbox::BBConfig do
|
|
|
99
99
|
|
|
100
100
|
it "returns false" do
|
|
101
101
|
config.client_name = client_name
|
|
102
|
-
expect(config.using_api_client?).to
|
|
102
|
+
expect(config.using_api_client?).to be false
|
|
103
103
|
end
|
|
104
104
|
end
|
|
105
105
|
end
|
|
@@ -28,7 +28,7 @@ describe Brightbox::CollaboratingAccount do
|
|
|
28
28
|
let(:initial_model) { owned_account }
|
|
29
29
|
|
|
30
30
|
it "returns true" do
|
|
31
|
-
expect(account.account?).to
|
|
31
|
+
expect(account.account?).to be true
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@ describe Brightbox::CollaboratingAccount do
|
|
|
36
36
|
let(:initial_model) { active_collaboration }
|
|
37
37
|
|
|
38
38
|
it "returns false'" do
|
|
39
|
-
expect(account.account?).to
|
|
39
|
+
expect(account.account?).to be false
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -46,7 +46,7 @@ describe Brightbox::CollaboratingAccount do
|
|
|
46
46
|
let(:initial_model) { owned_account }
|
|
47
47
|
|
|
48
48
|
it "returns false" do
|
|
49
|
-
expect(account.collaboration?).to
|
|
49
|
+
expect(account.collaboration?).to be false
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
@@ -54,7 +54,7 @@ describe Brightbox::CollaboratingAccount do
|
|
|
54
54
|
let(:initial_model) { active_collaboration }
|
|
55
55
|
|
|
56
56
|
it "returns true'" do
|
|
57
|
-
expect(account.collaboration?).to
|
|
57
|
+
expect(account.collaboration?).to be true
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
end
|
|
@@ -11,7 +11,7 @@ describe Brightbox::CollaboratingAccount do
|
|
|
11
11
|
|
|
12
12
|
it_behaves_like "a wrapped API resource"
|
|
13
13
|
|
|
14
|
-
it {
|
|
15
|
-
it {
|
|
16
|
-
it {
|
|
14
|
+
it { is_expected.to respond_to(:ram_free) }
|
|
15
|
+
it { is_expected.to respond_to(:cloud_ip_limit) }
|
|
16
|
+
it { is_expected.to respond_to(:lb_limit) }
|
|
17
17
|
end
|
|
@@ -42,7 +42,7 @@ describe Brightbox::Config::ApiClient do
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
it "sets persistent correctly" do
|
|
45
|
-
expect(for_fog[:persistent]).to
|
|
45
|
+
expect(for_fog[:persistent]).to be true
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
@@ -78,7 +78,7 @@ describe Brightbox::Config::ApiClient do
|
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
it "sets persistent correctly" do
|
|
81
|
-
expect(for_fog[:persistent]).to
|
|
81
|
+
expect(for_fog[:persistent]).to be false
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
|
|
@@ -19,7 +19,7 @@ describe Brightbox::Config::ApiClient do
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
it "is valid" do
|
|
22
|
-
|
|
22
|
+
expect(section).to be_valid
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -35,7 +35,7 @@ describe Brightbox::Config::ApiClient do
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
it "is valid" do
|
|
38
|
-
|
|
38
|
+
expect(section).to be_valid
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
@@ -49,7 +49,7 @@ describe Brightbox::Config::ApiClient do
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
it "is invalid" do
|
|
52
|
-
|
|
52
|
+
expect(section).to_not be_valid
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
|
|
@@ -63,7 +63,7 @@ describe Brightbox::Config::ApiClient do
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
it "is invalid" do
|
|
66
|
-
|
|
66
|
+
expect(section).to_not be_valid
|
|
67
67
|
end
|
|
68
68
|
end
|
|
69
69
|
|
|
@@ -77,7 +77,7 @@ describe Brightbox::Config::ApiClient do
|
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
it "is invalid" do
|
|
80
|
-
|
|
80
|
+
expect(section).to_not be_valid
|
|
81
81
|
end
|
|
82
82
|
end
|
|
83
83
|
end
|
|
@@ -33,7 +33,7 @@ describe Brightbox::Config::SectionNameDeduplicator do
|
|
|
33
33
|
|
|
34
34
|
context "when name has been deduped before" do
|
|
35
35
|
let(:name) { "dev" }
|
|
36
|
-
let(:in_use) {
|
|
36
|
+
let(:in_use) { %w(dev dev_1 dev_2) }
|
|
37
37
|
|
|
38
38
|
it "returns a deduplicated name" do
|
|
39
39
|
expect(deduper.next).to eql("dev_3")
|
|
@@ -9,9 +9,9 @@ describe Brightbox::BBConfig do
|
|
|
9
9
|
let(:contents) { "" }
|
|
10
10
|
|
|
11
11
|
it "raises an error" do
|
|
12
|
-
expect
|
|
12
|
+
expect do
|
|
13
13
|
fog_config
|
|
14
|
-
|
|
14
|
+
end.to raise_error(Brightbox::BBConfigError)
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -27,7 +27,7 @@ describe Brightbox::BBConfig do
|
|
|
27
27
|
let(:contents) { USER_APP_CONFIG_CONTENTS }
|
|
28
28
|
|
|
29
29
|
it "includes the password" do
|
|
30
|
-
|
|
30
|
+
skip "context is wrong to pass require values through"
|
|
31
31
|
expect(fog_config).to have_key(:brightbox_password)
|
|
32
32
|
end
|
|
33
33
|
end
|
|
@@ -43,7 +43,7 @@ describe Brightbox::Config::UserApplication do
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
it "sets persistent correctly" do
|
|
46
|
-
expect(for_fog[:persistent]).to
|
|
46
|
+
expect(for_fog[:persistent]).to be true
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -81,7 +81,7 @@ describe Brightbox::Config::UserApplication do
|
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
it "sets persistent correctly" do
|
|
84
|
-
expect(for_fog[:persistent]).to
|
|
84
|
+
expect(for_fog[:persistent]).to be false
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
|
|
@@ -20,7 +20,7 @@ describe Brightbox::Config::UserApplication do
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
it "is valid" do
|
|
23
|
-
|
|
23
|
+
expect(section).to be_valid
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -37,7 +37,7 @@ describe Brightbox::Config::UserApplication do
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
it "is valid" do
|
|
40
|
-
|
|
40
|
+
expect(section).to be_valid
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -52,7 +52,7 @@ describe Brightbox::Config::UserApplication do
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
it "is invalid" do
|
|
55
|
-
|
|
55
|
+
expect(section).to_not be_valid
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -67,7 +67,7 @@ describe Brightbox::Config::UserApplication do
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
it "is invalid" do
|
|
70
|
-
|
|
70
|
+
expect(section).to_not be_valid
|
|
71
71
|
end
|
|
72
72
|
end
|
|
73
73
|
|
|
@@ -82,7 +82,7 @@ describe Brightbox::Config::UserApplication do
|
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
it "is invalid" do
|
|
85
|
-
|
|
85
|
+
expect(section).to_not be_valid
|
|
86
86
|
end
|
|
87
87
|
end
|
|
88
88
|
|
|
@@ -97,7 +97,7 @@ describe Brightbox::Config::UserApplication do
|
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
it "is invalid" do
|
|
100
|
-
|
|
100
|
+
expect(section).to_not be_valid
|
|
101
101
|
end
|
|
102
102
|
end
|
|
103
103
|
end
|
|
@@ -15,13 +15,13 @@ describe Brightbox::ConnectionManager, "#fetch_connection" do
|
|
|
15
15
|
|
|
16
16
|
context "when not requesting a scoped connection" do
|
|
17
17
|
it "returns a fog compute instance" do
|
|
18
|
-
connection_manager.fetch_connection(false).
|
|
18
|
+
expect(connection_manager.fetch_connection(false)).to be_kind_of(Fog::Compute::Brightbox::Real)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
it "returns a connection without account scope" do
|
|
22
22
|
connection = connection_manager.fetch_connection(false)
|
|
23
|
-
connection.
|
|
24
|
-
connection.scoped_account.
|
|
23
|
+
expect(connection).not_to be_nil
|
|
24
|
+
expect(connection.scoped_account).to be_nil
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -29,13 +29,13 @@ describe Brightbox::ConnectionManager, "#fetch_connection" do
|
|
|
29
29
|
context "when a connection exists" do
|
|
30
30
|
it "upgrades existing connection with scoped account" do
|
|
31
31
|
connection = connection_manager.fetch_connection(false)
|
|
32
|
-
connection.
|
|
32
|
+
expect(connection).not_to be_nil
|
|
33
33
|
|
|
34
34
|
expect($config).to receive(:account).and_return("acc-abcde")
|
|
35
35
|
connection2 = connection_manager.fetch_connection(true)
|
|
36
|
-
connection2.
|
|
37
|
-
connection2.scoped_account.
|
|
38
|
-
connection2.scoped_account.
|
|
36
|
+
expect(connection2).to eq(connection)
|
|
37
|
+
expect(connection2.scoped_account).not_to be_nil
|
|
38
|
+
expect(connection2.scoped_account).to eq("acc-abcde")
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
end
|
|
@@ -43,30 +43,30 @@ describe Brightbox::ConnectionManager, "#fetch_connection" do
|
|
|
43
43
|
context "when a default account setting is set in config" do
|
|
44
44
|
let(:default_account) { "acc-12345" }
|
|
45
45
|
let(:selected_config) do
|
|
46
|
-
{"default_account" => default_account}
|
|
46
|
+
{ "default_account" => default_account }
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
it "selects configured account" do
|
|
50
|
-
|
|
51
|
-
$config.stubs(:selected_config).returns(
|
|
50
|
+
skip "Fails out of sequence, mocked config incorrect"
|
|
51
|
+
$config.stubs(:selected_config).returns('default_account' => "acc-12345")
|
|
52
52
|
connection = connection_manager.fetch_connection(true)
|
|
53
|
-
connection.
|
|
54
|
-
connection.scoped_account.
|
|
53
|
+
expect(connection).not_to be_nil
|
|
54
|
+
expect(connection.scoped_account).to eq("acc-12345")
|
|
55
55
|
end
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
context "when user has one account" do
|
|
59
59
|
it "selects that account" do
|
|
60
|
-
|
|
61
|
-
$config.
|
|
62
|
-
mock_account =
|
|
60
|
+
skip "Fails out of sequence, mocked config incorrect"
|
|
61
|
+
allow($config).to receive(:selected_config).and_call_original
|
|
62
|
+
mock_account = double
|
|
63
63
|
mock_account.expects(:id).returns("acc-xyg")
|
|
64
64
|
|
|
65
65
|
Brightbox::Account.expects(:all).returns([mock_account])
|
|
66
66
|
|
|
67
67
|
connection = connection_manager.fetch_connection(true)
|
|
68
|
-
connection.
|
|
69
|
-
connection.scoped_account.
|
|
68
|
+
expect(connection).not_to be_nil
|
|
69
|
+
expect(connection.scoped_account).to eq("acc-xyg")
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
end
|
|
@@ -5,8 +5,8 @@ describe Brightbox::FirewallPolicy do
|
|
|
5
5
|
describe "#apply_to", :vcr do
|
|
6
6
|
|
|
7
7
|
it "should apply firewall policy" do
|
|
8
|
-
|
|
9
|
-
params = { :name => "rspec_tests_apply"}
|
|
8
|
+
expect do
|
|
9
|
+
params = { :name => "rspec_tests_apply" }
|
|
10
10
|
group = Brightbox::ServerGroup.create(params)
|
|
11
11
|
firewall_options = {
|
|
12
12
|
:name => "rspec_firewall_policy_apply"
|
|
@@ -14,7 +14,7 @@ describe Brightbox::FirewallPolicy do
|
|
|
14
14
|
firewall_policy = Brightbox::FirewallPolicy.create(firewall_options)
|
|
15
15
|
firewall_policy.apply_to(group.id)
|
|
16
16
|
group.destroy
|
|
17
|
-
|
|
17
|
+
end.not_to raise_error
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
end
|
|
@@ -5,22 +5,22 @@ describe Brightbox::FirewallPolicy do
|
|
|
5
5
|
describe "#create", :vcr do
|
|
6
6
|
|
|
7
7
|
it "should create firewall policy" do
|
|
8
|
-
params = { :name => "rspec_tests"}
|
|
8
|
+
params = { :name => "rspec_tests" }
|
|
9
9
|
@group = Brightbox::ServerGroup.create(params)
|
|
10
|
-
|
|
10
|
+
expect do
|
|
11
11
|
firewall_options = {
|
|
12
12
|
:name => "rspec_firewall_policy",
|
|
13
13
|
:server_group_id => @group.id
|
|
14
14
|
}
|
|
15
15
|
@firewall_policy = Brightbox::FirewallPolicy.create(firewall_options)
|
|
16
|
-
end.
|
|
16
|
+
end.not_to raise_error
|
|
17
17
|
|
|
18
18
|
output = FauxIO.new do
|
|
19
|
-
Brightbox.render_table([@firewall_policy]
|
|
19
|
+
Brightbox.render_table([@firewall_policy], :vertical => true)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
expect(output.stdout).to match(/rspec_firewall_policy/)
|
|
23
|
-
@group.destroy
|
|
23
|
+
@group.destroy
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
end
|
|
@@ -4,17 +4,17 @@ describe Brightbox::FirewallPolicy do
|
|
|
4
4
|
|
|
5
5
|
describe "#destroy", :vcr do
|
|
6
6
|
it "should destroy firewall policy" do
|
|
7
|
-
params = { :name => "rspec_tests"}
|
|
7
|
+
params = { :name => "rspec_tests" }
|
|
8
8
|
@group = Brightbox::ServerGroup.create(params)
|
|
9
|
-
|
|
9
|
+
expect do
|
|
10
10
|
firewall_options = {
|
|
11
11
|
:name => "rspec_firewall_policy",
|
|
12
12
|
:server_group_id => @group.id
|
|
13
13
|
}
|
|
14
14
|
@firewall_policy = Brightbox::FirewallPolicy.create(firewall_options)
|
|
15
15
|
@firewall_policy.destroy
|
|
16
|
-
end.
|
|
17
|
-
@group.destroy
|
|
16
|
+
end.not_to raise_error
|
|
17
|
+
@group.destroy
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
end
|
|
@@ -14,7 +14,7 @@ describe Brightbox::FirewallPolicy do
|
|
|
14
14
|
it "should show firewall policy", :vcr do
|
|
15
15
|
output = FauxIO.new do
|
|
16
16
|
firewall_policy = Brightbox::FirewallPolicy.find_or_call([@policy.id])
|
|
17
|
-
Brightbox.render_table(firewall_policy
|
|
17
|
+
Brightbox.render_table(firewall_policy, :vertical => true)
|
|
18
18
|
end
|
|
19
19
|
expect(output.stdout).to include(@policy.id)
|
|
20
20
|
end
|
|
@@ -13,7 +13,7 @@ describe Brightbox::FirewallPolicy do
|
|
|
13
13
|
it "should list firewall policy", :vcr do
|
|
14
14
|
output = FauxIO.new do
|
|
15
15
|
firewall_policies = Brightbox::FirewallPolicy.find(:all)
|
|
16
|
-
Brightbox.render_table(firewall_policies
|
|
16
|
+
Brightbox.render_table(firewall_policies, :vertical => true)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
expect(output.stdout).to include(@policy.id)
|
|
@@ -20,7 +20,7 @@ describe Brightbox::FirewallRule do
|
|
|
20
20
|
it "creates the rule successfully", :vcr do
|
|
21
21
|
@rule = Brightbox::FirewallRule.create(@rule_options)
|
|
22
22
|
output = FauxIO.new do
|
|
23
|
-
Brightbox.render_table([@rule],
|
|
23
|
+
Brightbox.render_table([@rule], :vertical => true)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
expect(output.stdout).to include(@rule.id)
|
|
@@ -18,9 +18,9 @@ describe Brightbox::FirewallRule do
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
it "can display the result" do
|
|
21
|
-
expect
|
|
21
|
+
expect do
|
|
22
22
|
@rule = Brightbox::FirewallRule.find(@rule.id)
|
|
23
|
-
|
|
23
|
+
end.to_not raise_error
|
|
24
24
|
|
|
25
25
|
display_options = {
|
|
26
26
|
:fields => [
|
|
@@ -33,7 +33,7 @@ describe Brightbox::FirewallRule do
|
|
|
33
33
|
:icmp_type,
|
|
34
34
|
:firewall_policy
|
|
35
35
|
],
|
|
36
|
-
|
|
36
|
+
:vertical => true
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
output = FauxIO.new do
|
|
@@ -21,8 +21,8 @@ describe Brightbox::FirewallRule do
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
it "lists all rules" do
|
|
24
|
-
# FIXME from_policy does not seem to reload from API so uses a stale
|
|
25
|
-
#
|
|
24
|
+
# FIXME: from_policy does not seem to reload from API so uses a stale
|
|
25
|
+
# representation of the rules (Policy creation above)
|
|
26
26
|
@policy.reload
|
|
27
27
|
@policy_rules = Brightbox::FirewallRules.from_policy(@policy)
|
|
28
28
|
|