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
@@ -5,15 +5,29 @@ module Brightbox
|
|
5
5
|
cmd.arg_name "image-id..."
|
6
6
|
cmd.command [:show] do |c|
|
7
7
|
|
8
|
-
c.action do |global_options,
|
8
|
+
c.action do |global_options, _options, args|
|
9
9
|
images = Image.find_all_or_warn(args)
|
10
10
|
|
11
11
|
display_options = {
|
12
12
|
:vertical => true,
|
13
13
|
:fields => [
|
14
|
-
:id,
|
15
|
-
:
|
16
|
-
:
|
14
|
+
:id,
|
15
|
+
:type,
|
16
|
+
:owner,
|
17
|
+
:created_at,
|
18
|
+
:status,
|
19
|
+
:locked,
|
20
|
+
:arch,
|
21
|
+
:name,
|
22
|
+
:description,
|
23
|
+
:username,
|
24
|
+
:virtual_size,
|
25
|
+
:disk_size,
|
26
|
+
:public,
|
27
|
+
:"compatibility_mode",
|
28
|
+
:official,
|
29
|
+
:ancestor_id,
|
30
|
+
:licence_name
|
17
31
|
]
|
18
32
|
}
|
19
33
|
|
@@ -6,7 +6,7 @@ module Brightbox
|
|
6
6
|
cmd.arg_name "lb-id node-id..."
|
7
7
|
cmd.command [:add_nodes] do |c|
|
8
8
|
|
9
|
-
c.action do |global_options,
|
9
|
+
c.action do |global_options, _options, args|
|
10
10
|
|
11
11
|
raise "You must specify the load balancer and the node ids to add" if args.size < 2
|
12
12
|
|
@@ -6,7 +6,7 @@ module Brightbox
|
|
6
6
|
cmd.desc I18n.t("lbs.list.desc")
|
7
7
|
cmd.arg_name "[lb-id...]"
|
8
8
|
cmd.command [:list] do |c|
|
9
|
-
c.action do |global_options,
|
9
|
+
c.action do |global_options, _options, args|
|
10
10
|
lbs = LoadBalancer.find_all_or_warn(args)
|
11
11
|
render_table(lbs, global_options)
|
12
12
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Brightbox
|
2
|
+
command [:lbs] do |cmd|
|
3
|
+
cmd.desc I18n.t("lbs.lock.desc")
|
4
|
+
cmd.arg_name "[lbs-id...]"
|
5
|
+
cmd.command [:lock] do |c|
|
6
|
+
c.action do |_global_options, _options, args|
|
7
|
+
raise "You must specify load balancers as arguments" if args.empty?
|
8
|
+
|
9
|
+
balancers = LoadBalancer.find_or_call(args) do |balancer|
|
10
|
+
raise "Couldn't find #{balancer}"
|
11
|
+
end
|
12
|
+
|
13
|
+
balancers.each do |balancer|
|
14
|
+
info "Locking #{balancer}"
|
15
|
+
balancer.lock!
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
cmd.desc I18n.t("lbs.unlock.desc")
|
21
|
+
cmd.arg_name "[lbs-id...]"
|
22
|
+
cmd.command [:unlock] do |c|
|
23
|
+
c.action do |_global_options, _options, args|
|
24
|
+
raise "You must specify load balancers as arguments" if args.empty?
|
25
|
+
|
26
|
+
balancers = LoadBalancer.find_or_call(args) do |balancer|
|
27
|
+
raise "Couldn't find #{balancer}"
|
28
|
+
end
|
29
|
+
|
30
|
+
balancers.each do |balancer|
|
31
|
+
info "Unlocking #{balancer}"
|
32
|
+
balancer.unlock!
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -5,7 +5,7 @@ module Brightbox
|
|
5
5
|
cmd.arg_name "lb-id node-id..."
|
6
6
|
cmd.command [:remove_nodes] do |c|
|
7
7
|
|
8
|
-
c.action do |global_options,
|
8
|
+
c.action do |global_options, _options, args|
|
9
9
|
|
10
10
|
raise "You must specify the load balancer and the node ids to remove" if args.size < 2
|
11
11
|
|
@@ -5,7 +5,7 @@ module Brightbox
|
|
5
5
|
cmd.arg_name "lbs-id..."
|
6
6
|
cmd.command [:show] do |c|
|
7
7
|
|
8
|
-
c.action do |global_options,
|
8
|
+
c.action do |global_options, _options, args|
|
9
9
|
lbs = LoadBalancer.find_all_or_warn(args)
|
10
10
|
|
11
11
|
table_opts = global_options.merge(
|
@@ -13,6 +13,7 @@ module Brightbox
|
|
13
13
|
:fields => [
|
14
14
|
:id,
|
15
15
|
:status,
|
16
|
+
:locked,
|
16
17
|
:name,
|
17
18
|
:created_at,
|
18
19
|
:deleted_at,
|
@@ -25,7 +26,7 @@ module Brightbox
|
|
25
26
|
:nodes,
|
26
27
|
:listeners,
|
27
28
|
:healthcheck
|
28
|
-
|
29
|
+
])
|
29
30
|
|
30
31
|
render_table(lbs, table_opts)
|
31
32
|
|
@@ -6,7 +6,7 @@ module Brightbox
|
|
6
6
|
cmd.arg_name "server-id..."
|
7
7
|
cmd.command [:activate_console] do |c|
|
8
8
|
|
9
|
-
c.action do |global_options,
|
9
|
+
c.action do |global_options, _options, args|
|
10
10
|
|
11
11
|
raise "You must specify servers to activate the console for" if args.empty?
|
12
12
|
|
@@ -4,7 +4,7 @@ module Brightbox
|
|
4
4
|
cmd.desc I18n.t("servers.destroy.desc")
|
5
5
|
cmd.arg_name "[server-id...]"
|
6
6
|
cmd.command [:destroy] do |c|
|
7
|
-
c.action do |
|
7
|
+
c.action do |_global_options, _options, args|
|
8
8
|
|
9
9
|
raise "You must specify servers to destroy" if args.empty?
|
10
10
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Brightbox
|
2
|
+
command [:servers] do |cmd|
|
3
|
+
cmd.desc I18n.t("servers.lock.desc")
|
4
|
+
cmd.arg_name "[server-id...]"
|
5
|
+
cmd.command [:lock] do |c|
|
6
|
+
c.action do |_global_options, _options, args|
|
7
|
+
raise "You must specify server as arguments" if args.empty?
|
8
|
+
|
9
|
+
servers = Server.find_or_call(args) do |server|
|
10
|
+
raise "Couldn't find #{server}"
|
11
|
+
end
|
12
|
+
|
13
|
+
servers.each do |server|
|
14
|
+
info "Locking #{server}"
|
15
|
+
server.lock!
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
cmd.desc I18n.t("servers.unlock.desc")
|
21
|
+
cmd.arg_name "[server-id...]"
|
22
|
+
cmd.command [:unlock] do |c|
|
23
|
+
c.action do |_global_options, _options, args|
|
24
|
+
raise "You must specify servers as arguments" if args.empty?
|
25
|
+
|
26
|
+
servers = Server.find_or_call(args) do |server|
|
27
|
+
raise "Couldn't find #{server}"
|
28
|
+
end
|
29
|
+
|
30
|
+
servers.each do |server|
|
31
|
+
info "Unlocking #{server}"
|
32
|
+
server.unlock!
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Brightbox
|
2
|
+
command [:servers] do |cmd|
|
3
|
+
cmd.desc I18n.t("servers.reboot.desc")
|
4
|
+
cmd.arg_name "server-id..."
|
5
|
+
cmd.command [:reboot] do |c|
|
6
|
+
c.action do |_global_options, _options, args|
|
7
|
+
raise "You must specify servers to reboot" if args.empty?
|
8
|
+
|
9
|
+
servers = Server.find_or_call(args) do |id|
|
10
|
+
raise "Couldn't find #{id}"
|
11
|
+
end
|
12
|
+
|
13
|
+
servers.each do |server|
|
14
|
+
info "Sending reboot to #{server}"
|
15
|
+
server.reboot(false)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Brightbox
|
2
|
+
command [:servers] do |cmd|
|
3
|
+
cmd.desc I18n.t("servers.reset.desc")
|
4
|
+
cmd.arg_name "server-id..."
|
5
|
+
cmd.command [:reset] do |c|
|
6
|
+
c.action do |_global_options, _options, args|
|
7
|
+
raise "You must specify servers to reset" if args.empty?
|
8
|
+
|
9
|
+
servers = Server.find_or_call(args) do |id|
|
10
|
+
raise "Couldn't find #{id}"
|
11
|
+
end
|
12
|
+
|
13
|
+
servers.each do |server|
|
14
|
+
info "Sending reset to #{server}"
|
15
|
+
server.reboot(true)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -5,7 +5,7 @@ module Brightbox
|
|
5
5
|
cmd.arg_name "server-id..."
|
6
6
|
cmd.command [:show] do |c|
|
7
7
|
|
8
|
-
c.action do |global_options,
|
8
|
+
c.action do |global_options, _options, args|
|
9
9
|
servers = DetailedServer.find_all_or_warn(args)
|
10
10
|
|
11
11
|
table_opts = global_options.merge(:vertical => true)
|
@@ -4,7 +4,7 @@ module Brightbox
|
|
4
4
|
cmd.desc I18n.t("servers.shutdown.desc")
|
5
5
|
cmd.arg_name "server-id..."
|
6
6
|
cmd.command [:shutdown] do |c|
|
7
|
-
c.action do |
|
7
|
+
c.action do |_global_options, _options, args|
|
8
8
|
|
9
9
|
raise "You must specify servers to shutdown" if args.empty?
|
10
10
|
|
@@ -5,7 +5,7 @@ module Brightbox
|
|
5
5
|
cmd.desc I18n.t("sql.instances.destroy.desc")
|
6
6
|
cmd.arg_name "[instance-id...]"
|
7
7
|
cmd.command [:destroy] do |c|
|
8
|
-
c.action do |
|
8
|
+
c.action do |_global_options, _options, args|
|
9
9
|
|
10
10
|
raise "You must specify instance IDs to destroy" if args.empty?
|
11
11
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Brightbox
|
2
|
+
command [:sql] do |product|
|
3
|
+
product.command [:instances] do |cmd|
|
4
|
+
cmd.desc I18n.t("sql.instances.lock.desc")
|
5
|
+
cmd.arg_name "[instance-id...]"
|
6
|
+
cmd.command [:lock] do |c|
|
7
|
+
c.action do |_global_options, _options, args|
|
8
|
+
raise "You must specify sql instances as arguments" if args.empty?
|
9
|
+
|
10
|
+
instances = DatabaseServer.find_or_call(args) do |instance|
|
11
|
+
raise "Couldn't find #{instance}"
|
12
|
+
end
|
13
|
+
|
14
|
+
instances.each do |instance|
|
15
|
+
info "Locking #{instance}"
|
16
|
+
instance.lock!
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
cmd.desc I18n.t("sql.instances.unlock.desc")
|
22
|
+
cmd.arg_name "[instance-id...]"
|
23
|
+
cmd.command [:unlock] do |c|
|
24
|
+
c.action do |_global_options, _options, args|
|
25
|
+
raise "You must specify sql instances as arguments" if args.empty?
|
26
|
+
|
27
|
+
instances = DatabaseServer.find_or_call(args) do |instance|
|
28
|
+
raise "Couldn't find #{instance}"
|
29
|
+
end
|
30
|
+
|
31
|
+
instances.each do |instance|
|
32
|
+
info "Unlocking #{instance}"
|
33
|
+
instance.unlock!
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -5,7 +5,7 @@ module Brightbox
|
|
5
5
|
cmd.desc I18n.t("sql.instances.reset_password.desc")
|
6
6
|
cmd.arg_name "server-id"
|
7
7
|
cmd.command [:"reset-password"] do |c|
|
8
|
-
c.action do |global_options,
|
8
|
+
c.action do |global_options, _options, args|
|
9
9
|
dbs_id = args.shift
|
10
10
|
unless dbs_id =~ /^dbs-/
|
11
11
|
raise "You must specify a valid SQL instance ID as the first argument"
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Brightbox
|
2
|
+
command [:sql] do |product|
|
3
|
+
product.command [:snapshots] do |cmd|
|
4
|
+
cmd.desc I18n.t("sql.snapshots.lock.desc")
|
5
|
+
cmd.arg_name "[snapshot-id...]"
|
6
|
+
cmd.command [:lock] do |c|
|
7
|
+
c.action do |_global_options, _options, args|
|
8
|
+
raise "You must specify sql snapshots as arguments" if args.empty?
|
9
|
+
|
10
|
+
snapshots = DatabaseSnapshot.find_or_call(args) do |snapshot|
|
11
|
+
raise "Couldn't find #{snapshot}"
|
12
|
+
end
|
13
|
+
|
14
|
+
snapshots.each do |snapshot|
|
15
|
+
info "Locking #{snapshot}"
|
16
|
+
snapshot.lock!
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
cmd.desc I18n.t("sql.snapshots.unlock.desc")
|
22
|
+
cmd.arg_name "[snapshot-id...]"
|
23
|
+
cmd.command [:unlock] do |c|
|
24
|
+
c.action do |_global_options, _options, args|
|
25
|
+
raise "You must specify sql snapshots as arguments" if args.empty?
|
26
|
+
|
27
|
+
snapshots = DatabaseSnapshot.find_or_call(args) do |snapshot|
|
28
|
+
raise "Couldn't find #{snapshot}"
|
29
|
+
end
|
30
|
+
|
31
|
+
snapshots.each do |snapshot|
|
32
|
+
info "Unlocking #{snapshot}"
|
33
|
+
snapshot.unlock!
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -6,7 +6,7 @@ module Brightbox
|
|
6
6
|
cmd.arg_name "[snapshot-id...]"
|
7
7
|
cmd.command [:show] do |c|
|
8
8
|
|
9
|
-
c.action do |global_options,
|
9
|
+
c.action do |global_options, _options, args|
|
10
10
|
|
11
11
|
raise "You must specify snapshot ids to show" if args.empty?
|
12
12
|
|
@@ -16,7 +16,14 @@ module Brightbox
|
|
16
16
|
|
17
17
|
table_opts = global_options.merge(
|
18
18
|
:vertical => true,
|
19
|
-
:fields => [
|
19
|
+
:fields => [
|
20
|
+
:id,
|
21
|
+
:name,
|
22
|
+
:description,
|
23
|
+
:status,
|
24
|
+
:locked,
|
25
|
+
:created_on
|
26
|
+
]
|
20
27
|
)
|
21
28
|
render_table(servers, table_opts)
|
22
29
|
end
|
@@ -10,7 +10,7 @@ module Brightbox
|
|
10
10
|
cmd.arg_name "[type-id...]"
|
11
11
|
cmd.command [:list] do |c|
|
12
12
|
|
13
|
-
c.action do |global_options,
|
13
|
+
c.action do |global_options, _options, args|
|
14
14
|
|
15
15
|
if args.empty?
|
16
16
|
types = DatabaseType.find :all
|
@@ -28,7 +28,7 @@ module Brightbox
|
|
28
28
|
cmd.arg_name "[type-id...]"
|
29
29
|
cmd.command [:show] do |c|
|
30
30
|
|
31
|
-
c.action do |global_options,
|
31
|
+
c.action do |global_options, _options, args|
|
32
32
|
|
33
33
|
if args.empty?
|
34
34
|
raise "You must specify the types you want to show"
|
@@ -8,7 +8,7 @@ module Brightbox
|
|
8
8
|
cmd.arg_name "[type-id...]"
|
9
9
|
cmd.command [:list] do |c|
|
10
10
|
|
11
|
-
c.action do |global_options,
|
11
|
+
c.action do |global_options, _options, args|
|
12
12
|
|
13
13
|
if args.empty?
|
14
14
|
types = Type.find :all
|
@@ -26,7 +26,7 @@ module Brightbox
|
|
26
26
|
cmd.arg_name "type-id..."
|
27
27
|
cmd.command [:show] do |c|
|
28
28
|
|
29
|
-
c.action do |global_options,
|
29
|
+
c.action do |global_options, _options, args|
|
30
30
|
|
31
31
|
if args.empty?
|
32
32
|
raise "You must specify the types you want to show"
|
@@ -7,7 +7,7 @@ module Brightbox
|
|
7
7
|
cmd.desc "List your collaborations"
|
8
8
|
cmd.arg_name "[collaboration-id...]"
|
9
9
|
cmd.command [:list] do |c|
|
10
|
-
c.action do |global_options,
|
10
|
+
c.action do |global_options, _options, args|
|
11
11
|
if args.empty?
|
12
12
|
collaborations = UserCollaboration.find(:all)
|
13
13
|
else
|
@@ -22,7 +22,7 @@ module Brightbox
|
|
22
22
|
cmd.desc "Show details of collaborations"
|
23
23
|
cmd.arg_name "[collaboration-id...]"
|
24
24
|
cmd.command [:show] do |c|
|
25
|
-
c.action do |global_options,
|
25
|
+
c.action do |global_options, _options, args|
|
26
26
|
collaborations = UserCollaboration.find_or_call(args) do |id|
|
27
27
|
warn "Couldn't find collaboration #{id}"
|
28
28
|
end
|
@@ -44,7 +44,7 @@ module Brightbox
|
|
44
44
|
service = Fog::Compute.new(to_fog)
|
45
45
|
accounts = service.accounts
|
46
46
|
|
47
|
-
@account = accounts.select { |acc| %w
|
47
|
+
@account = accounts.select { |acc| %w(pending active).include?(acc.status) }.first.id
|
48
48
|
save_default_account(@account) if @account
|
49
49
|
rescue Brightbox::BBConfigError
|
50
50
|
# We can't get a suitable fog connection so we can't select an
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Brightbox
|
2
2
|
module Config
|
3
3
|
class ApiClient
|
4
|
-
NON_BLANK_KEYS = %w
|
4
|
+
NON_BLANK_KEYS = %w(api_url client_id secret)
|
5
5
|
|
6
6
|
attr_accessor :selected_config, :client_name
|
7
7
|
|
@@ -31,8 +31,8 @@ module Brightbox
|
|
31
31
|
private
|
32
32
|
|
33
33
|
def persistent?
|
34
|
-
if selected_config["persistent"]
|
35
|
-
|
34
|
+
if selected_config["persistent"] == "false"
|
35
|
+
false
|
36
36
|
else
|
37
37
|
true
|
38
38
|
end
|
@@ -12,7 +12,7 @@ module Brightbox
|
|
12
12
|
if defined?(@access_token) && !@access_token.nil?
|
13
13
|
return @access_token
|
14
14
|
end
|
15
|
-
if File.
|
15
|
+
if File.exist?(access_token_filename)
|
16
16
|
@access_token = cached_access_token
|
17
17
|
else
|
18
18
|
@access_token = nil
|
@@ -28,7 +28,7 @@ module Brightbox
|
|
28
28
|
if defined?(@refresh_token) && !@refresh_token.nil?
|
29
29
|
return @refresh_token
|
30
30
|
end
|
31
|
-
if File.
|
31
|
+
if File.exist?(refresh_token_filename)
|
32
32
|
@refresh_token = cached_refresh_token
|
33
33
|
else
|
34
34
|
@refresh_token = nil
|
@@ -3,7 +3,7 @@ module Brightbox
|
|
3
3
|
class UserApplication
|
4
4
|
# FIXME: api_url should use fog's underlying default
|
5
5
|
#
|
6
|
-
NON_BLANK_KEYS = %w
|
6
|
+
NON_BLANK_KEYS = %w(api_url client_id secret username)
|
7
7
|
|
8
8
|
attr_accessor :selected_config, :client_name
|
9
9
|
|
@@ -56,8 +56,8 @@ module Brightbox
|
|
56
56
|
private
|
57
57
|
|
58
58
|
def persistent?
|
59
|
-
if selected_config["persistent"]
|
60
|
-
|
59
|
+
if selected_config["persistent"] == "false"
|
60
|
+
false
|
61
61
|
else
|
62
62
|
true
|
63
63
|
end
|