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.
Files changed (245) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/Gemfile +0 -2
  4. data/Gemfile.lock +25 -23
  5. data/Rakefile +1 -1
  6. data/bin/_brightbox-bash-completer +327 -328
  7. data/bin/brightbox +2 -2
  8. data/bin/brightbox-accounts +2 -2
  9. data/bin/brightbox-cloudips +2 -2
  10. data/bin/brightbox-config +2 -2
  11. data/bin/brightbox-firewall-policies +2 -2
  12. data/bin/brightbox-firewall-rules +2 -2
  13. data/bin/brightbox-groups +2 -2
  14. data/bin/brightbox-images +2 -2
  15. data/bin/brightbox-lbs +2 -2
  16. data/bin/brightbox-servers +2 -2
  17. data/bin/brightbox-types +2 -2
  18. data/bin/brightbox-users +2 -2
  19. data/bin/brightbox-zones +2 -2
  20. data/brightbox-cli.gemspec +14 -15
  21. data/lib/brightbox-cli/api.rb +4 -6
  22. data/lib/brightbox-cli/collaboration.rb +1 -3
  23. data/lib/brightbox-cli/commands/accounts/accept-invite.rb +1 -1
  24. data/lib/brightbox-cli/commands/accounts/default.rb +1 -1
  25. data/lib/brightbox-cli/commands/accounts/list.rb +1 -1
  26. data/lib/brightbox-cli/commands/accounts/remove.rb +1 -1
  27. data/lib/brightbox-cli/commands/accounts/reset-ftp-password.rb +1 -1
  28. data/lib/brightbox-cli/commands/accounts/show.rb +1 -1
  29. data/lib/brightbox-cli/commands/cloudips/create.rb +1 -1
  30. data/lib/brightbox-cli/commands/cloudips/destroy.rb +1 -1
  31. data/lib/brightbox-cli/commands/cloudips/list.rb +1 -1
  32. data/lib/brightbox-cli/commands/cloudips/show.rb +1 -1
  33. data/lib/brightbox-cli/commands/cloudips/unmap.rb +1 -1
  34. data/lib/brightbox-cli/commands/collaborations.rb +4 -4
  35. data/lib/brightbox-cli/commands/config/client-add.rb +1 -1
  36. data/lib/brightbox-cli/commands/config/client-default.rb +1 -1
  37. data/lib/brightbox-cli/commands/config/client-list.rb +1 -1
  38. data/lib/brightbox-cli/commands/config/client-remove.rb +1 -1
  39. data/lib/brightbox-cli/commands/config/user-add.rb +1 -1
  40. data/lib/brightbox-cli/commands/firewall/policies-destroy.rb +1 -1
  41. data/lib/brightbox-cli/commands/firewall/policies-list.rb +1 -1
  42. data/lib/brightbox-cli/commands/firewall/policies-show.rb +1 -1
  43. data/lib/brightbox-cli/commands/firewall/rules-destroy.rb +1 -1
  44. data/lib/brightbox-cli/commands/firewall/rules-list.rb +1 -1
  45. data/lib/brightbox-cli/commands/firewall/rules-show.rb +1 -1
  46. data/lib/brightbox-cli/commands/groups/add-server.rb +1 -1
  47. data/lib/brightbox-cli/commands/groups/create.rb +1 -1
  48. data/lib/brightbox-cli/commands/groups/destroy.rb +1 -1
  49. data/lib/brightbox-cli/commands/groups/list.rb +1 -1
  50. data/lib/brightbox-cli/commands/groups/show.rb +1 -1
  51. data/lib/brightbox-cli/commands/images/destroy.rb +1 -1
  52. data/lib/brightbox-cli/commands/images/locking.rb +37 -0
  53. data/lib/brightbox-cli/commands/images/register.rb +1 -1
  54. data/lib/brightbox-cli/commands/images/show.rb +18 -4
  55. data/lib/brightbox-cli/commands/lbs/add-nodes.rb +1 -1
  56. data/lib/brightbox-cli/commands/lbs/destroy.rb +1 -1
  57. data/lib/brightbox-cli/commands/lbs/list.rb +1 -1
  58. data/lib/brightbox-cli/commands/lbs/locking.rb +37 -0
  59. data/lib/brightbox-cli/commands/lbs/remove-nodes.rb +1 -1
  60. data/lib/brightbox-cli/commands/lbs/show.rb +3 -2
  61. data/lib/brightbox-cli/commands/servers/activate-console.rb +1 -1
  62. data/lib/brightbox-cli/commands/servers/destroy.rb +1 -1
  63. data/lib/brightbox-cli/commands/servers/locking.rb +37 -0
  64. data/lib/brightbox-cli/commands/servers/reboot.rb +20 -0
  65. data/lib/brightbox-cli/commands/servers/reset.rb +20 -0
  66. data/lib/brightbox-cli/commands/servers/show.rb +1 -1
  67. data/lib/brightbox-cli/commands/servers/shutdown.rb +1 -1
  68. data/lib/brightbox-cli/commands/servers/snapshot.rb +1 -1
  69. data/lib/brightbox-cli/commands/servers/start.rb +1 -1
  70. data/lib/brightbox-cli/commands/servers/stop.rb +1 -1
  71. data/lib/brightbox-cli/commands/sql/instances_create.rb +1 -1
  72. data/lib/brightbox-cli/commands/sql/instances_destroy.rb +1 -1
  73. data/lib/brightbox-cli/commands/sql/instances_list.rb +1 -1
  74. data/lib/brightbox-cli/commands/sql/instances_locking.rb +39 -0
  75. data/lib/brightbox-cli/commands/sql/instances_reset_password.rb +1 -1
  76. data/lib/brightbox-cli/commands/sql/instances_show.rb +1 -1
  77. data/lib/brightbox-cli/commands/sql/instances_snapshot.rb +1 -1
  78. data/lib/brightbox-cli/commands/sql/snapshots_destroy.rb +1 -1
  79. data/lib/brightbox-cli/commands/sql/snapshots_list.rb +1 -1
  80. data/lib/brightbox-cli/commands/sql/snapshots_locking.rb +39 -0
  81. data/lib/brightbox-cli/commands/sql/snapshots_show.rb +9 -2
  82. data/lib/brightbox-cli/commands/sql/types.rb +2 -2
  83. data/lib/brightbox-cli/commands/types.rb +2 -2
  84. data/lib/brightbox-cli/commands/user-collaborations.rb +2 -2
  85. data/lib/brightbox-cli/commands/users/list.rb +1 -1
  86. data/lib/brightbox-cli/commands/users/show.rb +1 -1
  87. data/lib/brightbox-cli/commands/zones.rb +1 -1
  88. data/lib/brightbox-cli/config/accounts.rb +1 -1
  89. data/lib/brightbox-cli/config/api_client.rb +3 -3
  90. data/lib/brightbox-cli/config/authentication_tokens.rb +2 -2
  91. data/lib/brightbox-cli/config/cache.rb +1 -1
  92. data/lib/brightbox-cli/config/dirty.rb +1 -1
  93. data/lib/brightbox-cli/config/user_application.rb +3 -3
  94. data/lib/brightbox-cli/config.rb +2 -2
  95. data/lib/brightbox-cli/database_server.rb +2 -1
  96. data/lib/brightbox-cli/database_snapshot.rb +1 -0
  97. data/lib/brightbox-cli/detailed_server.rb +1 -0
  98. data/lib/brightbox-cli/gli_global_hooks.rb +2 -2
  99. data/lib/brightbox-cli/images.rb +2 -1
  100. data/lib/brightbox-cli/legacy/args_adjuster.rb +3 -3
  101. data/lib/brightbox-cli/load_balancers.rb +1 -0
  102. data/lib/brightbox-cli/servers.rb +2 -1
  103. data/lib/brightbox-cli/user_collaboration.rb +1 -1
  104. data/lib/brightbox-cli/version.rb +1 -1
  105. data/lib/brightbox_cli.rb +3 -3
  106. data/locales/en.yml +24 -0
  107. data/spec/commands/accounts/default_spec.rb +2 -2
  108. data/spec/commands/accounts/list_spec.rb +7 -7
  109. data/spec/commands/accounts/reset_ftp_password_spec.rb +2 -2
  110. data/spec/commands/accounts/show_spec.rb +2 -2
  111. data/spec/commands/cloudips/create_spec.rb +2 -2
  112. data/spec/commands/cloudips/destroy_spec.rb +2 -2
  113. data/spec/commands/cloudips/list_spec.rb +2 -2
  114. data/spec/commands/cloudips/map_spec.rb +3 -3
  115. data/spec/commands/cloudips/show_spec.rb +2 -2
  116. data/spec/commands/cloudips/unmap_spec.rb +2 -2
  117. data/spec/commands/cloudips/update_spec.rb +2 -2
  118. data/spec/commands/config/client_add_spec.rb +2 -2
  119. data/spec/commands/config/client_default_spec.rb +2 -2
  120. data/spec/commands/config/client_list_spec.rb +2 -2
  121. data/spec/commands/config/client_remove_spec.rb +2 -2
  122. data/spec/commands/config/user_add_spec.rb +3 -6
  123. data/spec/commands/firewall_policies/update_spec.rb +7 -7
  124. data/spec/commands/groups/add_server_spec.rb +2 -2
  125. data/spec/commands/groups/create_spec.rb +2 -2
  126. data/spec/commands/groups/destroy_spec.rb +2 -2
  127. data/spec/commands/groups/list_spec.rb +2 -2
  128. data/spec/commands/groups/move_servers_spec.rb +2 -2
  129. data/spec/commands/groups/remove_servers_spec.rb +2 -2
  130. data/spec/commands/groups/show_spec.rb +2 -2
  131. data/spec/commands/groups/update_spec.rb +2 -2
  132. data/spec/commands/images/destroy_spec.rb +2 -2
  133. data/spec/commands/images/list_spec.rb +2 -2
  134. data/spec/commands/images/locking_spec.rb +73 -0
  135. data/spec/commands/images/register_spec.rb +2 -2
  136. data/spec/commands/images/show_spec.rb +2 -2
  137. data/spec/commands/images/update_spec.rb +2 -2
  138. data/spec/commands/lbs/add_nodes_spec.rb +2 -2
  139. data/spec/commands/lbs/create_spec.rb +2 -2
  140. data/spec/commands/lbs/destroy_spec.rb +2 -2
  141. data/spec/commands/lbs/list_spec.rb +2 -2
  142. data/spec/commands/lbs/locking_spec.rb +73 -0
  143. data/spec/commands/lbs/remove_nodes_spec.rb +2 -2
  144. data/spec/commands/lbs/show_spec.rb +2 -2
  145. data/spec/commands/lbs/update_spec.rb +2 -2
  146. data/spec/commands/policies/apply_spec.rb +2 -2
  147. data/spec/commands/policies/create_spec.rb +2 -2
  148. data/spec/commands/policies/destroy_spec.rb +2 -2
  149. data/spec/commands/policies/list_spec.rb +2 -2
  150. data/spec/commands/policies/remove_spec.rb +2 -2
  151. data/spec/commands/policies/show_spec.rb +2 -2
  152. data/spec/commands/policies/update_spec.rb +2 -2
  153. data/spec/commands/rules/create_spec.rb +2 -2
  154. data/spec/commands/rules/destroy_spec.rb +2 -2
  155. data/spec/commands/rules/list_spec.rb +2 -2
  156. data/spec/commands/rules/show_spec.rb +2 -2
  157. data/spec/commands/rules/update_spec.rb +2 -2
  158. data/spec/commands/servers/activate_console_spec.rb +2 -2
  159. data/spec/commands/servers/create_spec.rb +2 -2
  160. data/spec/commands/servers/destroy_spec.rb +2 -2
  161. data/spec/commands/servers/list_spec.rb +2 -2
  162. data/spec/commands/servers/locking_spec.rb +73 -0
  163. data/spec/commands/servers/reboot_spec.rb +55 -0
  164. data/spec/commands/servers/reset_spec.rb +55 -0
  165. data/spec/commands/servers/show_spec.rb +2 -2
  166. data/spec/commands/servers/shutdown_spec.rb +2 -2
  167. data/spec/commands/servers/snapshot_spec.rb +2 -2
  168. data/spec/commands/servers/start_spec.rb +2 -2
  169. data/spec/commands/servers/stop_spec.rb +2 -2
  170. data/spec/commands/servers/update_spec.rb +2 -2
  171. data/spec/commands/sql/instances/create_spec.rb +4 -4
  172. data/spec/commands/sql/instances/locking_spec.rb +73 -0
  173. data/spec/commands/sql/instances/snapshot_spec.rb +2 -2
  174. data/spec/commands/sql/snapshots/list_spec.rb +1 -1
  175. data/spec/commands/sql/snapshots/locking_spec.rb +73 -0
  176. data/spec/commands/sql/snapshots/show_spec.rb +1 -1
  177. data/spec/commands/sql/types/list_spec.rb +1 -1
  178. data/spec/commands/types/list_spec.rb +2 -2
  179. data/spec/commands/users/list_spec.rb +2 -2
  180. data/spec/commands/users/show_spec.rb +2 -2
  181. data/spec/commands/users/update_spec.rb +2 -2
  182. data/spec/commands/zones/list_spec.rb +2 -2
  183. data/spec/spec_helper.rb +8 -9
  184. data/spec/support/common_helpers.rb +10 -10
  185. data/spec/support/config_helpers.rb +0 -1
  186. data/spec/support/faux_io.rb +10 -14
  187. data/spec/support/password_prompt_helpers.rb +1 -2
  188. data/spec/support/server_helper.rb +1 -1
  189. data/spec/support/shared/api_resource_examples.rb +8 -8
  190. data/spec/support/shared/collaborating_accounts_context.rb +2 -2
  191. data/spec/support/shared/config_section_types.rb +2 -2
  192. data/spec/support/tmp_config.rb +4 -8
  193. data/spec/support/token_helpers.rb +1 -1
  194. data/spec/support/vcr.rb +1 -1
  195. data/spec/unit/brightbox/account/get_spec.rb +1 -1
  196. data/spec/unit/brightbox/account_spec.rb +3 -3
  197. data/spec/unit/brightbox/api/find_spec.rb +6 -6
  198. data/spec/unit/brightbox/api/require_account_spec.rb +1 -1
  199. data/spec/unit/brightbox/bb_config/account_spec.rb +3 -3
  200. data/spec/unit/brightbox/bb_config/clear_default_client_spec.rb +8 -8
  201. data/spec/unit/brightbox/bb_config/client_has_alias_spec.rb +3 -3
  202. data/spec/unit/brightbox/bb_config/client_name_spec.rb +5 -5
  203. data/spec/unit/brightbox/bb_config/client_named_spec.rb +6 -6
  204. data/spec/unit/brightbox/bb_config/config_directory_exists_spec.rb +3 -3
  205. data/spec/unit/brightbox/bb_config/config_spec.rb +5 -5
  206. data/spec/unit/brightbox/bb_config/default_account_spec.rb +6 -6
  207. data/spec/unit/brightbox/bb_config/default_client_spec.rb +2 -2
  208. data/spec/unit/brightbox/bb_config/find_or_set_default_account_spec.rb +14 -14
  209. data/spec/unit/brightbox/bb_config/has_multiple_clients_spec.rb +2 -2
  210. data/spec/unit/brightbox/bb_config/renew_tokens_spec.rb +4 -5
  211. data/spec/unit/brightbox/bb_config/save_spec.rb +2 -2
  212. data/spec/unit/brightbox/bb_config/to_fog_spec.rb +2 -2
  213. data/spec/unit/brightbox/bb_config/using_client_spec.rb +10 -10
  214. data/spec/unit/brightbox/collaborating_account/resource_type_spec.rb +4 -4
  215. data/spec/unit/brightbox/collaborating_account_spec.rb +3 -3
  216. data/spec/unit/brightbox/config/api_client/to_fog_spec.rb +2 -2
  217. data/spec/unit/brightbox/config/api_client/valid_spec.rb +5 -5
  218. data/spec/unit/brightbox/config/section_name_deduplicator_spec.rb +1 -1
  219. data/spec/unit/brightbox/config/to_fog_spec.rb +3 -3
  220. data/spec/unit/brightbox/config/user_application/to_fog_spec.rb +2 -2
  221. data/spec/unit/brightbox/config/user_application/valid_spec.rb +6 -6
  222. data/spec/unit/brightbox/connection_manager/fetch_connection_spec.rb +17 -17
  223. data/spec/unit/brightbox/firewall_policy/apply_to_spec.rb +3 -3
  224. data/spec/unit/brightbox/firewall_policy/create_spec.rb +5 -5
  225. data/spec/unit/brightbox/firewall_policy/destroy_spec.rb +4 -4
  226. data/spec/unit/brightbox/firewall_policy/find_or_call_spec.rb +1 -1
  227. data/spec/unit/brightbox/firewall_policy/find_spec.rb +1 -1
  228. data/spec/unit/brightbox/firewall_rule/create_spec.rb +1 -1
  229. data/spec/unit/brightbox/firewall_rule/destroy_spec.rb +2 -2
  230. data/spec/unit/brightbox/firewall_rule/find_spec.rb +3 -3
  231. data/spec/unit/brightbox/firewall_rule/from_policy_spec.rb +2 -2
  232. data/spec/unit/brightbox/legacy/args_adjuster_spec.rb +12 -12
  233. data/spec/unit/brightbox/server/create_spec.rb +2 -2
  234. data/spec/unit/brightbox/server/destroy_spec.rb +3 -3
  235. data/spec/unit/brightbox/server/find_or_call_spec.rb +1 -1
  236. data/spec/unit/brightbox/server/shutdown_spec.rb +2 -4
  237. data/spec/unit/brightbox/server/start_spec.rb +4 -4
  238. data/spec/unit/brightbox/server/stop_spec.rb +2 -4
  239. data/spec/unit/brightbox/server/update_spec.rb +2 -2
  240. data/spec/unit/brightbox/server_group/find_spec.rb +1 -1
  241. data/spec/unit/brightbox/user_collaboration/get_for_account_spec.rb +4 -4
  242. data/spec/unit/brightbox/user_collaboration/remove_spec.rb +11 -11
  243. data/spec/unit/nilable_hash_spec.rb +6 -6
  244. data/spec/unit/tmp_config_spec.rb +1 -1
  245. metadata +67 -31
data/bin/brightbox CHANGED
@@ -4,8 +4,8 @@ begin
4
4
  require "brightbox_cli"
5
5
  rescue LoadError
6
6
  brightbox_cli_path = File.expand_path('../../lib', __FILE__)
7
- $:.unshift(brightbox_cli_path)
7
+ $LOAD_PATH.unshift(brightbox_cli_path)
8
8
  require "brightbox_cli"
9
9
  end
10
10
 
11
- Brightbox::run ARGV
11
+ Brightbox.run ARGV
@@ -5,9 +5,9 @@ begin
5
5
  require "brightbox-cli/legacy/args_adjuster"
6
6
  rescue LoadError
7
7
  brightbox_cli_path = File.expand_path('../../lib', __FILE__)
8
- $:.unshift(brightbox_cli_path)
8
+ $LOAD_PATH.unshift(brightbox_cli_path)
9
9
  require "brightbox_cli"
10
10
  require "brightbox-cli/legacy/args_adjuster"
11
11
  end
12
12
 
13
- Brightbox::run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("accounts")
13
+ Brightbox.run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("accounts")
@@ -5,9 +5,9 @@ begin
5
5
  require "brightbox-cli/legacy/args_adjuster"
6
6
  rescue LoadError
7
7
  brightbox_cli_path = File.expand_path('../../lib', __FILE__)
8
- $:.unshift(brightbox_cli_path)
8
+ $LOAD_PATH.unshift(brightbox_cli_path)
9
9
  require "brightbox_cli"
10
10
  require "brightbox-cli/legacy/args_adjuster"
11
11
  end
12
12
 
13
- Brightbox::run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("cloudips")
13
+ Brightbox.run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("cloudips")
data/bin/brightbox-config CHANGED
@@ -5,9 +5,9 @@ begin
5
5
  require "brightbox-cli/legacy/args_adjuster"
6
6
  rescue LoadError
7
7
  brightbox_cli_path = File.expand_path('../../lib', __FILE__)
8
- $:.unshift(brightbox_cli_path)
8
+ $LOAD_PATH.unshift(brightbox_cli_path)
9
9
  require "brightbox_cli"
10
10
  require "brightbox-cli/legacy/args_adjuster"
11
11
  end
12
12
 
13
- Brightbox::run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("config")
13
+ Brightbox.run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("config")
@@ -5,9 +5,9 @@ begin
5
5
  require "brightbox-cli/legacy/args_adjuster"
6
6
  rescue LoadError
7
7
  brightbox_cli_path = File.expand_path('../../lib', __FILE__)
8
- $:.unshift(brightbox_cli_path)
8
+ $LOAD_PATH.unshift(brightbox_cli_path)
9
9
  require "brightbox_cli"
10
10
  require "brightbox-cli/legacy/args_adjuster"
11
11
  end
12
12
 
13
- Brightbox::run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("firewall-policies")
13
+ Brightbox.run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("firewall-policies")
@@ -5,9 +5,9 @@ begin
5
5
  require "brightbox-cli/legacy/args_adjuster"
6
6
  rescue LoadError
7
7
  brightbox_cli_path = File.expand_path('../../lib', __FILE__)
8
- $:.unshift(brightbox_cli_path)
8
+ $LOAD_PATH.unshift(brightbox_cli_path)
9
9
  require "brightbox_cli"
10
10
  require "brightbox-cli/legacy/args_adjuster"
11
11
  end
12
12
 
13
- Brightbox::run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("firewall-rules")
13
+ Brightbox.run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("firewall-rules")
data/bin/brightbox-groups CHANGED
@@ -5,9 +5,9 @@ begin
5
5
  require "brightbox-cli/legacy/args_adjuster"
6
6
  rescue LoadError
7
7
  brightbox_cli_path = File.expand_path('../../lib', __FILE__)
8
- $:.unshift(brightbox_cli_path)
8
+ $LOAD_PATH.unshift(brightbox_cli_path)
9
9
  require "brightbox_cli"
10
10
  require "brightbox-cli/legacy/args_adjuster"
11
11
  end
12
12
 
13
- Brightbox::run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("groups")
13
+ Brightbox.run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("groups")
data/bin/brightbox-images CHANGED
@@ -5,9 +5,9 @@ begin
5
5
  require "brightbox-cli/legacy/args_adjuster"
6
6
  rescue LoadError
7
7
  brightbox_cli_path = File.expand_path('../../lib', __FILE__)
8
- $:.unshift(brightbox_cli_path)
8
+ $LOAD_PATH.unshift(brightbox_cli_path)
9
9
  require "brightbox_cli"
10
10
  require "brightbox-cli/legacy/args_adjuster"
11
11
  end
12
12
 
13
- Brightbox::run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("images")
13
+ Brightbox.run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("images")
data/bin/brightbox-lbs CHANGED
@@ -5,9 +5,9 @@ begin
5
5
  require "brightbox-cli/legacy/args_adjuster"
6
6
  rescue LoadError
7
7
  brightbox_cli_path = File.expand_path('../../lib', __FILE__)
8
- $:.unshift(brightbox_cli_path)
8
+ $LOAD_PATH.unshift(brightbox_cli_path)
9
9
  require "brightbox_cli"
10
10
  require "brightbox-cli/legacy/args_adjuster"
11
11
  end
12
12
 
13
- Brightbox::run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("lbs")
13
+ Brightbox.run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("lbs")
@@ -5,9 +5,9 @@ begin
5
5
  require "brightbox-cli/legacy/args_adjuster"
6
6
  rescue LoadError
7
7
  brightbox_cli_path = File.expand_path('../../lib', __FILE__)
8
- $:.unshift(brightbox_cli_path)
8
+ $LOAD_PATH.unshift(brightbox_cli_path)
9
9
  require "brightbox_cli"
10
10
  require "brightbox-cli/legacy/args_adjuster"
11
11
  end
12
12
 
13
- Brightbox::run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("servers")
13
+ Brightbox.run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("servers")
data/bin/brightbox-types CHANGED
@@ -5,9 +5,9 @@ begin
5
5
  require "brightbox-cli/legacy/args_adjuster"
6
6
  rescue LoadError
7
7
  brightbox_cli_path = File.expand_path('../../lib', __FILE__)
8
- $:.unshift(brightbox_cli_path)
8
+ $LOAD_PATH.unshift(brightbox_cli_path)
9
9
  require "brightbox_cli"
10
10
  require "brightbox-cli/legacy/args_adjuster"
11
11
  end
12
12
 
13
- Brightbox::run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("types")
13
+ Brightbox.run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("types")
data/bin/brightbox-users CHANGED
@@ -5,9 +5,9 @@ begin
5
5
  require "brightbox-cli/legacy/args_adjuster"
6
6
  rescue LoadError
7
7
  brightbox_cli_path = File.expand_path('../../lib', __FILE__)
8
- $:.unshift(brightbox_cli_path)
8
+ $LOAD_PATH.unshift(brightbox_cli_path)
9
9
  require "brightbox_cli"
10
10
  require "brightbox-cli/legacy/args_adjuster"
11
11
  end
12
12
 
13
- Brightbox::run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("users")
13
+ Brightbox.run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("users")
data/bin/brightbox-zones CHANGED
@@ -5,9 +5,9 @@ begin
5
5
  require "brightbox-cli/legacy/args_adjuster"
6
6
  rescue LoadError
7
7
  brightbox_cli_path = File.expand_path('../../lib', __FILE__)
8
- $:.unshift(brightbox_cli_path)
8
+ $LOAD_PATH.unshift(brightbox_cli_path)
9
9
  require "brightbox_cli"
10
10
  require "brightbox-cli/legacy/args_adjuster"
11
11
  end
12
12
 
13
- Brightbox::run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("zones")
13
+ Brightbox.run Brightbox::Legacy::ArgsAdjuster.new(ARGV).for_command("zones")
@@ -8,31 +8,30 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["John Leach"]
9
9
  s.email = ["john@brightbox.co.uk"]
10
10
  s.homepage = "http://docs.brightbox.com/cli"
11
- s.summary = %q{The Brightbox cloud management system}
12
- s.description = %q{Scripts to interact with the Brightbox cloud API}
11
+ s.summary = %q(The Brightbox cloud management system)
12
+ s.description = %q(Scripts to interact with the Brightbox cloud API)
13
13
  s.license = "MIT"
14
14
 
15
15
  s.rubyforge_project = "brightbox-cli"
16
16
 
17
17
  s.files = `git ls-files`.split("\n") + `find lib/brightbox-cli/vendor`.split("\n")
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
+ s.add_dependency "fog-brightbox", "~> 0.3"
22
23
  s.add_dependency "gli", "~> 2.9"
23
- s.add_dependency "fog-brightbox"
24
- s.add_dependency "multi_json"
25
- s.add_dependency "mime-types", "~> 1.25"
26
-
27
24
  s.add_dependency "i18n"
28
-
29
- s.add_dependency('hirb','~> 0.6')
30
- s.add_dependency('highline', '~> 1.6')
31
-
32
- s.add_development_dependency('rake')
33
- s.add_development_dependency('vcr', '~> 2.5')
34
- s.add_development_dependency('rspec', '~> 2.14')
35
- s.add_development_dependency('mocha')
25
+ s.add_dependency "mime-types", "~> 1.25"
26
+ s.add_dependency "multi_json"
27
+ s.add_dependency "highline", "~> 1.6"
28
+ s.add_dependency "hirb", "~> 0.6"
29
+
30
+ s.add_development_dependency "mocha"
31
+ s.add_development_dependency "pry"
32
+ s.add_development_dependency "rake"
33
+ s.add_development_dependency "rspec", "~> 2.99"
34
+ s.add_development_dependency "vcr", "~> 2.5"
36
35
 
37
36
  s.post_install_message = <<-EOS
38
37
  The CLI command is now `brightbox` with subcommands for the resources.
@@ -99,9 +99,7 @@ module Brightbox
99
99
  def self.find(args = :all, options = {})
100
100
  raise InvalidArguments, "find(nil)" if args.nil?
101
101
  raise InvalidArguments, "find([])" if args.respond_to?(:empty?) && args.empty?
102
- options = {
103
- :order => :created_at,
104
- }.merge options
102
+ options = { :order => :created_at }.merge(options)
105
103
 
106
104
  objects = nil
107
105
  object = nil
@@ -110,11 +108,11 @@ module Brightbox
110
108
  objects = all
111
109
  elsif args.is_a? String
112
110
  object = cached_get(args.to_s)
113
- raise NotFound, "Couldn't find '#{args.to_s}'" if object.nil?
111
+ raise NotFound, "Couldn't find '#{args}'" if object.nil?
114
112
  elsif args.respond_to? :map
115
113
  objects = args.map do |arg|
116
114
  o = cached_get(arg.to_s)
117
- raise NotFound, "Couldn't find '#{arg.to_s}'" if o.nil?
115
+ raise NotFound, "Couldn't find '#{arg}'" if o.nil?
118
116
  o
119
117
  end
120
118
  else
@@ -140,7 +138,7 @@ module Brightbox
140
138
 
141
139
  # Find each id in the given array. Yield the block with any ids
142
140
  # that couldn't be found
143
- def self.find_or_call(ids, &block)
141
+ def self.find_or_call(ids, &_block)
144
142
  objects = []
145
143
  ids.each do |id|
146
144
  begin
@@ -29,9 +29,7 @@ module Brightbox
29
29
  @id
30
30
  end
31
31
 
32
- def id
33
- @id
34
- end
32
+ attr_reader :id
35
33
 
36
34
  def attributes
37
35
  fog_model.attributes
@@ -5,7 +5,7 @@ module Brightbox
5
5
  cmd.desc I18n.t("accounts.accept_invite.desc")
6
6
  cmd.arg_name "account_id"
7
7
  cmd.command [:accept_invite] do |c|
8
- c.action do |global_options, options, args|
8
+ c.action do |global_options, _options, args|
9
9
  account_id = args.first
10
10
 
11
11
  # Find the collaboration for that account
@@ -5,7 +5,7 @@ module Brightbox
5
5
  cmd.arg_name "account-id"
6
6
  cmd.command [:default] do |c|
7
7
 
8
- c.action do |global_options, options, args|
8
+ c.action do |_global_options, _options, args|
9
9
  if args.empty?
10
10
  raise "You must specify the account-id to set as default."
11
11
  end
@@ -7,7 +7,7 @@ module Brightbox
7
7
  cmd.arg_name "[account-id...]"
8
8
  cmd.command [:list] do |c|
9
9
 
10
- c.action do |global_options, options, args|
10
+ c.action do |global_options, _options, _args|
11
11
  if $config.using_application?
12
12
  # Collaborating Accounts are combined from owned and collaborations
13
13
  accounts = CollaboratingAccount.all
@@ -4,7 +4,7 @@ module Brightbox
4
4
  cmd.desc I18n.t("accounts.remove.desc")
5
5
  cmd.arg_name "account_id"
6
6
  cmd.command [:remove] do |c|
7
- c.action do |global_options, options, args|
7
+ c.action do |global_options, _options, args|
8
8
  account_id = args.first
9
9
 
10
10
  # Find the collaboration for that account
@@ -5,7 +5,7 @@ module Brightbox
5
5
  cmd.arg_name "account-id..."
6
6
  cmd.command [:reset_ftp_password] do |c|
7
7
 
8
- c.action do |global_options, options, args|
8
+ c.action do |global_options, _options, args|
9
9
 
10
10
  if args.empty?
11
11
  raise "You must specify the accounts to reset ftp passwords for"
@@ -5,7 +5,7 @@ module Brightbox
5
5
  cmd.arg_name "account-id..."
6
6
  cmd.command [:show] do |c|
7
7
 
8
- c.action do |global_options, options, args|
8
+ c.action do |global_options, _options, args|
9
9
 
10
10
  if args.empty?
11
11
  raise "You must specify the accounts to show"
@@ -15,7 +15,7 @@ module Brightbox
15
15
  c.desc I18n.t("cloudips.options.port_translators.desc")
16
16
  c.flag [:t, :"port-translators"]
17
17
 
18
- c.action do |global_options, options, args|
18
+ c.action do |global_options, options, _args|
19
19
 
20
20
  if options[:i].to_s !~ /^[0-9]+$/
21
21
  raise "count must be a number"
@@ -8,7 +8,7 @@ module Brightbox
8
8
  c.desc "Unmap mapped IPs before destroying them"
9
9
  c.switch [:u, "unmap"], :negatable => false
10
10
 
11
- c.action do |global_options, options, args|
11
+ c.action do |_global_options, options, args|
12
12
 
13
13
  if args.empty?
14
14
  raise "You must specify the Cloud IPs you want to destroy"
@@ -7,7 +7,7 @@ module Brightbox
7
7
  cmd.arg_name "[cloudip-id...]"
8
8
  cmd.command [:list] do |c|
9
9
 
10
- c.action do |global_options, options, args|
10
+ c.action do |global_options, _options, args|
11
11
  ips = CloudIP.find_all_or_warn(args)
12
12
  render_table(ips.sort, global_options)
13
13
  end
@@ -5,7 +5,7 @@ module Brightbox
5
5
  cmd.arg_name "cloudip-id..."
6
6
  cmd.command [:show] do |c|
7
7
 
8
- c.action do |global_options, options, args|
8
+ c.action do |global_options, _options, args|
9
9
 
10
10
  if args.empty?
11
11
  raise "You must specify the cloud ips you want to show"
@@ -5,7 +5,7 @@ module Brightbox
5
5
  cmd.arg_name "cloudip-id..."
6
6
  cmd.command [:unmap] do |c|
7
7
 
8
- c.action do |global_options, options, args|
8
+ c.action do |global_options, _options, args|
9
9
 
10
10
  if args.empty?
11
11
  raise "You must specify the Cloud IPs you want to unmap"
@@ -7,7 +7,7 @@ module Brightbox
7
7
  cmd.desc "List an accounts collaborations"
8
8
  cmd.arg_name "[collaboration-id...]"
9
9
  cmd.command [:list] do |c|
10
- c.action do |global_options, options, args|
10
+ c.action do |global_options, _options, args|
11
11
  collaborations = Collaboration.find_all_or_warn(args)
12
12
  render_table(collaborations, global_options)
13
13
  end
@@ -32,7 +32,7 @@ module Brightbox
32
32
  cmd.desc "Resends an invitation email for a pending collaboration"
33
33
  cmd.arg_name "collaboration-id"
34
34
  cmd.command [:resend] do |c|
35
- c.action do |global_options, options, args|
35
+ c.action do |global_options, _options, args|
36
36
  collaborations = Collaboration.find_or_call(args) do |id|
37
37
  warn "Couldn't find collaboration #{id}"
38
38
  end
@@ -44,7 +44,7 @@ module Brightbox
44
44
  cmd.desc "Show details of collaborations"
45
45
  cmd.arg_name "[collaboration-id...]"
46
46
  cmd.command [:show] do |c|
47
- c.action do |global_options, options, args|
47
+ c.action do |global_options, _options, args|
48
48
  collaborations = Collaboration.find_or_call(args) do |id|
49
49
  warn "Couldn't find collaboration #{id}"
50
50
  end
@@ -55,7 +55,7 @@ module Brightbox
55
55
  cmd.desc "Destroy collaborations"
56
56
  cmd.arg_name "[collaboration-id...]"
57
57
  cmd.command [:destroy] do |c|
58
- c.action do |global_options, options, args|
58
+ c.action do |global_options, _options, args|
59
59
  collaborations = Collaboration.find_or_call(args) do |id|
60
60
  warn "Couldn't find collaboration #{id}"
61
61
  end
@@ -12,7 +12,7 @@ module Brightbox
12
12
  c.desc "auth url"
13
13
  c.flag [:t, "auth-url"]
14
14
 
15
- c.action do |global_options, options, args|
15
+ c.action do |_global_options, options, args|
16
16
 
17
17
  info "Using config file #{$config.config_filename}"
18
18
 
@@ -5,7 +5,7 @@ module Brightbox
5
5
  cmd.arg_name "alias"
6
6
  cmd.command [:client_default] do |c|
7
7
 
8
- c.action do |global_options, options, args|
8
+ c.action do |_global_options, _options, args|
9
9
 
10
10
  info "Using config file #{$config.config_filename}"
11
11
  calias = args.shift
@@ -6,7 +6,7 @@ module Brightbox
6
6
  cmd.desc I18n.t("config.client_list.desc")
7
7
  cmd.command [:client_list] do |c|
8
8
 
9
- c.action do |global_options, options, args|
9
+ c.action do |global_options, _options, _args|
10
10
 
11
11
  info "Using config file #{$config.config_filename}"
12
12
 
@@ -5,7 +5,7 @@ module Brightbox
5
5
  cmd.arg_name "alias"
6
6
  cmd.command [:client_remove] do |c|
7
7
 
8
- c.action do |global_options, options, args|
8
+ c.action do |_global_options, _options, args|
9
9
 
10
10
  info "Using config file #{$config.config_filename}"
11
11
 
@@ -11,7 +11,7 @@ module Brightbox
11
11
  c.desc "password, if not specified you will be prompted"
12
12
  c.flag [:p, "password"]
13
13
 
14
- c.action do |global_options, options, args|
14
+ c.action do |_global_options, options, args|
15
15
 
16
16
  require 'highline'
17
17
 
@@ -5,7 +5,7 @@ module Brightbox
5
5
  cmd.arg_name "[firewall-policy-id...]"
6
6
  cmd.command [:destroy] do |c|
7
7
 
8
- c.action do |global_options, options, args|
8
+ c.action do |_global_options, _options, args|
9
9
 
10
10
  raise "You must specify firewall-policy-id to destroy" if args.empty?
11
11
 
@@ -7,7 +7,7 @@ module Brightbox
7
7
  cmd.arg_name "[firewall-policy-id...]"
8
8
  cmd.command [:list] do |c|
9
9
 
10
- c.action do |global_options, options, args|
10
+ c.action do |global_options, _options, args|
11
11
  firewall_policies = FirewallPolicy.find_all_or_warn(args)
12
12
  render_table(firewall_policies, global_options)
13
13
  end
@@ -5,7 +5,7 @@ module Brightbox
5
5
  cmd.arg_name "firewall-policy-id"
6
6
  cmd.command [:show] do |c|
7
7
 
8
- c.action do |global_options, options, args|
8
+ c.action do |global_options, _options, args|
9
9
  raise "You must specify server groups to show" if args.empty?
10
10
 
11
11
  policies = FirewallPolicy.find_or_call(args) do |id|
@@ -5,7 +5,7 @@ module Brightbox
5
5
  cmd.arg_name "[firewall-rule-id...]"
6
6
  cmd.command [:destroy] do |c|
7
7
 
8
- c.action do |global_options, options, args|
8
+ c.action do |_global_options, _options, args|
9
9
  raise "You must specify firewall-rule-id to destroy" if args.empty?
10
10
 
11
11
  firewall_rules = FirewallRule.find_or_call(args) do |id|
@@ -7,7 +7,7 @@ module Brightbox
7
7
  cmd.arg_name "[firewall-policy-id...]"
8
8
  cmd.command [:list] do |c|
9
9
 
10
- c.action do |global_options, options, args|
10
+ c.action do |global_options, _options, args|
11
11
  if args.empty?
12
12
  raise "You must specify the firewall policy id as the first argument"
13
13
  end
@@ -5,7 +5,7 @@ module Brightbox
5
5
  cmd.arg_name "firewall-rule-id"
6
6
  cmd.command [:show] do |c|
7
7
 
8
- c.action do |global_options, options, args|
8
+ c.action do |global_options, _options, args|
9
9
  raise "You must specify server groups to show" if args.empty?
10
10
 
11
11
  policies = FirewallRule.find_or_call(args) do |id|
@@ -6,7 +6,7 @@ module Brightbox
6
6
  cmd.arg_name "grp-id [srv-id...]"
7
7
  cmd.command [:add_servers] do |c|
8
8
 
9
- c.action do |global_options, options, args|
9
+ c.action do |global_options, _options, args|
10
10
  grp_id = args.shift
11
11
  raise "You must specify the server group and then the server ids to add" unless grp_id && grp_id[/^grp-/] && !args.empty?
12
12
 
@@ -9,7 +9,7 @@ module Brightbox
9
9
  c.desc I18n.t("options.description.desc")
10
10
  c.flag [:d, :description]
11
11
 
12
- c.action do |global_options, options, args|
12
+ c.action do |global_options, options, _args|
13
13
  params = {}
14
14
 
15
15
  params[:name] = options[:n] if options[:n]
@@ -6,7 +6,7 @@ module Brightbox
6
6
  # TODO: add option to remove all servers from group before destroying
7
7
  cmd.command [:destroy] do |c|
8
8
 
9
- c.action do |global_options, options, args|
9
+ c.action do |_global_options, _options, args|
10
10
  raise "You must specify the server groups to destroy" if args.empty?
11
11
 
12
12
  sgs = ServerGroup.find_or_call(args) do |id|
@@ -5,7 +5,7 @@ module Brightbox
5
5
 
6
6
  cmd.desc I18n.t("groups.list.desc")
7
7
  cmd.command [:list] do |c|
8
- c.action do |global_options, options, args|
8
+ c.action do |global_options, _options, args|
9
9
  server_groups = ServerGroup.find_all_or_warn(args)
10
10
  render_table(server_groups, global_options)
11
11
  end
@@ -5,7 +5,7 @@ module Brightbox
5
5
  cmd.arg_name "[grp-id..]"
6
6
  cmd.command [:show] do |c|
7
7
 
8
- c.action do |global_options, options, args|
8
+ c.action do |global_options, _options, args|
9
9
  raise "You must specify server groups to show" if args.empty?
10
10
 
11
11
  sgs = DetailedServerGroup.find_or_call(args) do |id|
@@ -6,7 +6,7 @@ module Brightbox
6
6
  cmd.arg_name "image-id..."
7
7
  cmd.command [:destroy] do |c|
8
8
 
9
- c.action do |global_options, options, args|
9
+ c.action do |global_options, _options, args|
10
10
 
11
11
  if args.empty?
12
12
  raise "You must specify the images you want to destroy"
@@ -0,0 +1,37 @@
1
+ module Brightbox
2
+ command [:images] do |cmd|
3
+ cmd.desc I18n.t("images.lock.desc")
4
+ cmd.arg_name "[image-id...]"
5
+ cmd.command [:lock] do |c|
6
+ c.action do |_global_options, _options, args|
7
+ raise "You must specify image as arguments" if args.empty?
8
+
9
+ images = Image.find_or_call(args) do |image|
10
+ raise "Couldn't find #{image}"
11
+ end
12
+
13
+ images.each do |image|
14
+ info "Locking #{image}"
15
+ image.lock!
16
+ end
17
+ end
18
+ end
19
+
20
+ cmd.desc I18n.t("images.unlock.desc")
21
+ cmd.arg_name "[image-id...]"
22
+ cmd.command [:unlock] do |c|
23
+ c.action do |_global_options, _options, args|
24
+ raise "You must specify images as arguments" if args.empty?
25
+
26
+ images = Image.find_or_call(args) do |image|
27
+ raise "Couldn't find #{image}"
28
+ end
29
+
30
+ images.each do |image|
31
+ info "Unlocking #{image}"
32
+ image.unlock!
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -27,7 +27,7 @@ module Brightbox
27
27
  c.default_value "false"
28
28
  c.flag [:p, "public"]
29
29
 
30
- c.action do |global_options, options, args|
30
+ c.action do |global_options, options, _args|
31
31
 
32
32
  raise "You must specify the architecture" unless options[:a]
33
33
  raise "You must specify the source filename" unless options[:s]