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.
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
@@ -50,7 +50,7 @@ module Brightbox
50
50
  #
51
51
  # @return [Boolean]
52
52
  def config_directory_exists?
53
- File.exists?(config_directory) && File.directory?(config_directory)
53
+ File.exist?(config_directory) && File.directory?(config_directory)
54
54
  end
55
55
 
56
56
  # The String path to the configuration file itself (in .ini format)
@@ -126,7 +126,7 @@ module Brightbox
126
126
  # in
127
127
  #
128
128
  def create_directory
129
- unless File.exists? config_directory
129
+ unless File.exist? config_directory
130
130
  begin
131
131
  FileUtils.mkdir config_directory
132
132
  rescue Errno::EEXIST
@@ -46,7 +46,7 @@ module Brightbox
46
46
  # These are all the fields show in the longer table form
47
47
  def self.detailed_fields
48
48
  [
49
- :id, :name, :description, :status,
49
+ :id, :name, :description, :status, :locked,
50
50
  :type, :engine, :version,
51
51
  :zone,
52
52
  :created_on,
@@ -71,6 +71,7 @@ module Brightbox
71
71
  def to_row
72
72
  a = fog_model.attributes
73
73
  a[:status] = fog_model.state
74
+ a[:locked] = locked?
74
75
  a[:type] = type_identifier
75
76
  a[:db_engine] = engine_version
76
77
  a[:engine] = database_engine
@@ -29,6 +29,7 @@ module Brightbox
29
29
  def to_row
30
30
  a = fog_model.attributes
31
31
  a[:status] = fog_model.state
32
+ a[:locked] = locked?
32
33
  a[:created_on] = fog_model.created_at.strftime("%Y-%m-%d")
33
34
  a
34
35
  end
@@ -37,6 +37,7 @@ module Brightbox
37
37
  [
38
38
  :id,
39
39
  :status,
40
+ :locked,
40
41
  :name,
41
42
  :created_at,
42
43
  :deleted_at,
@@ -32,7 +32,7 @@ module Brightbox
32
32
  desc "Disable peer SSL certificate verification"
33
33
  switch [:k, :insecure], :negatable => false
34
34
 
35
- pre do |global_options, command, options, args|
35
+ pre do |global_options, command, _options, _args|
36
36
  if command.topmost_ancestor.name == :config
37
37
  force_default_config = false
38
38
  else
@@ -73,7 +73,7 @@ module Brightbox
73
73
  true
74
74
  end
75
75
 
76
- post do |global_options, command, options, args|
76
+ post do |_global_options, _command, _options, _args|
77
77
  begin
78
78
  # Api.conn is another global which holds the authentication tokens so
79
79
  # we need to shuffle data between globals at a higher level rather than
@@ -45,7 +45,7 @@ module Brightbox
45
45
  end
46
46
 
47
47
  snapshots = images.select { |i| i.source_type == 'snapshot' }
48
- images = images - snapshots
48
+ images -= snapshots
49
49
 
50
50
  images.sort! { |a, b| a.default_sort_fields <=> b.default_sort_fields }
51
51
  snapshots.sort! { |a, b| a.created_at <=> b.created_at }
@@ -78,6 +78,7 @@ module Brightbox
78
78
  o = fog_model.attributes
79
79
  o[:id] = fog_model.id
80
80
  o[:status] = status
81
+ o[:locked] = locked?
81
82
  o[:username] = username
82
83
  o[:arch] = arch
83
84
  o[:name] = name.to_s + " (#{arch})"
@@ -16,9 +16,9 @@ module Brightbox
16
16
  @globals = []
17
17
 
18
18
  parser = OptionParser.new do |opts|
19
- opts.on("-v", "--version") { |op| @globals << "-v" }
20
- opts.on("-s", "--simple") { |op| @globals << "-s" }
21
- opts.on("-k", "--insecure") { |op| @globals << "-k" }
19
+ opts.on("-v", "--version") { |_op| @globals << "-v" }
20
+ opts.on("-s", "--simple") { |_op| @globals << "-s" }
21
+ opts.on("-k", "--insecure") { |_op| @globals << "-k" }
22
22
  opts.on("-c", "--client CLIENT") { |op| @globals << "-c" << op }
23
23
  opts.on("--account ACCOUNT") { |op| @globals << "--account" << op }
24
24
  end
@@ -11,6 +11,7 @@ module Brightbox
11
11
 
12
12
  def to_row
13
13
  attributes.merge(
14
+ :locked => locked?,
14
15
  :ssl_issuer => certificate_issuer,
15
16
  :ssl_subject => certificate_subject,
16
17
  :ssl_valid_from => certificate_valid_from,
@@ -3,7 +3,7 @@ module Brightbox
3
3
  def self.require_account?; true; end
4
4
 
5
5
  def self.create_servers(count, options)
6
- (0...count).map { |i| create(options) }
6
+ (0...count).map { |_i| create(options) }
7
7
  end
8
8
 
9
9
  def self.create(options)
@@ -43,6 +43,7 @@ module Brightbox
43
43
  a[:created_on] = created_on
44
44
  a[:type] = server_type['handle']
45
45
  a[:status] = fog_model.state
46
+ a[:locked] = locked?
46
47
  a[:zone] = zone && zone['handle']
47
48
  a[:hostname] = id
48
49
  a[:public_hostname] = "public.#{fqdn}" unless cloud_ips.empty?
@@ -24,7 +24,7 @@ module Brightbox
24
24
  #
25
25
  def self.get_for_account(account_id)
26
26
  collaborations = conn.user_collaborations
27
- open_collaborations = collaborations.select { |col| %w{pending accepted}.include?(col.status) }
27
+ open_collaborations = collaborations.select { |col| %w(pending accepted).include?(col.status) }
28
28
  collaboration = open_collaborations.find do |col|
29
29
  col.account_id == account_id
30
30
  end
@@ -1,3 +1,3 @@
1
1
  module Brightbox
2
- VERSION = "1.2.2" unless defined?(Brightbox::VERSION)
2
+ VERSION = "1.3.0" unless defined?(Brightbox::VERSION)
3
3
  end
data/lib/brightbox_cli.rb CHANGED
@@ -10,14 +10,14 @@ lib_dir = File.expand_path(File.dirname(__FILE__))
10
10
 
11
11
  $LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include?(lib_dir)
12
12
 
13
- os_config = File.join(lib_dir,"brightbox-cli","os_config.rb")
13
+ os_config = File.join(lib_dir, "brightbox-cli", "os_config.rb")
14
14
  require os_config if File.exist? os_config
15
15
 
16
- vendor_dir = File.expand_path(File.join(lib_dir, 'brightbox-cli','vendor'))
16
+ vendor_dir = File.expand_path(File.join(lib_dir, 'brightbox-cli', 'vendor'))
17
17
 
18
18
  # Add any vendored libraries into search path
19
19
  Dir.glob(vendor_dir + '/*').each do |f|
20
- $:.unshift File.join(f, 'lib')
20
+ $LOAD_PATH.unshift File.join(f, 'lib')
21
21
  end
22
22
 
23
23
  require "multi_json"
data/locales/en.yml CHANGED
@@ -104,10 +104,14 @@ en:
104
104
  desc: Destroy images
105
105
  list:
106
106
  desc: List images
107
+ lock:
108
+ desc: Lock images
107
109
  register:
108
110
  desc: Register an image in the image library
109
111
  show:
110
112
  desc: Show images
113
+ unlock:
114
+ desc: Unlock images
111
115
  update:
112
116
  desc: Update an image
113
117
  lbs:
@@ -121,10 +125,14 @@ en:
121
125
  desc: Destroy load balancers
122
126
  list:
123
127
  desc: List load balancers
128
+ lock:
129
+ desc: Lock load balancers
124
130
  remove_nodes:
125
131
  desc: Remove servers from a load balancer
126
132
  show:
127
133
  desc: Show load balancers
134
+ unlock:
135
+ desc: Unlock load balancers
128
136
  update:
129
137
  desc: Update a load balancer
130
138
  long_desc: All intervals and timeouts are in milliseconds
@@ -136,6 +144,12 @@ en:
136
144
  desc: Create servers
137
145
  destroy:
138
146
  desc: Destroy servers
147
+ lock:
148
+ desc: Lock servers
149
+ reboot:
150
+ desc: Reboot servers (OS reboot issued)
151
+ reset:
152
+ desc: Reset servers (Hardward reset issued)
139
153
  show:
140
154
  desc: Show servers
141
155
  shutdown:
@@ -146,6 +160,8 @@ en:
146
160
  desc: Start servers
147
161
  stop:
148
162
  desc: Stop servers with equivalent of powering off
163
+ unlock:
164
+ desc: Unlock servers
149
165
  update:
150
166
  desc: Update a server
151
167
  sql:
@@ -169,6 +185,8 @@ en:
169
185
  desc: Create a new Cloud SQL instance
170
186
  destroy:
171
187
  desc: Destroy Cloud SQL instances
188
+ lock:
189
+ desc: Lock Cloud SQL instances
172
190
  list:
173
191
  desc: List Cloud SQL instances
174
192
  reset_password:
@@ -177,16 +195,22 @@ en:
177
195
  desc: Show details of Cloud SQL instances
178
196
  snapshot:
179
197
  desc: Create a new Cloud SQL snapshot from an instance
198
+ unlock:
199
+ desc: Unlock Cloud SQL instances
180
200
  update:
181
201
  desc: Update a Cloud SQL instance
182
202
  snapshots:
183
203
  desc: Manage Cloud SQL snapshots
184
204
  list:
185
205
  desc: List Cloud SQL snapshots
206
+ lock:
207
+ desc: Lock Cloud SQL snapshots
186
208
  destroy:
187
209
  desc: Destroy a number of Cloud SQL snapshots
188
210
  show:
189
211
  desc: Show details of Cloud SQL snapshots
212
+ unlock:
213
+ desc: Unlock Cloud SQL snapshots
190
214
  update:
191
215
  desc: Update a Cloud SQL snapshot's metadata
192
216
  types:
@@ -3,12 +3,12 @@ require "spec_helper"
3
3
  describe "brightbox accounts" do
4
4
 
5
5
  describe "default" do
6
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
6
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
10
  context "" do
11
- let(:argv) { ["accounts", "default"] }
11
+ let(:argv) { %w(accounts default) }
12
12
 
13
13
  it "does not error" do
14
14
  expect { output }.to_not raise_error
@@ -3,12 +3,12 @@ require "spec_helper"
3
3
  describe "brightbox accounts" do
4
4
 
5
5
  describe "list" do
6
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
6
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
10
  context "", :vcr do
11
- let(:argv) { ["accounts", "list"] }
11
+ let(:argv) { %w(accounts list) }
12
12
 
13
13
  it "does not error" do
14
14
  expect { output }.to_not raise_error
@@ -18,7 +18,7 @@ describe "brightbox accounts" do
18
18
  context "(when no tokens)", :vcr do
19
19
  let(:password) { default_test_password }
20
20
 
21
- let(:argv) { ["accounts", "list"] }
21
+ let(:argv) { %w(accounts list) }
22
22
 
23
23
  before do
24
24
  config_from_contents(USER_APP_CONFIG_CONTENTS)
@@ -37,7 +37,7 @@ describe "brightbox accounts" do
37
37
  context "(when no tokens and password incorrect)", :vcr do
38
38
  let(:password) { "wrong" }
39
39
 
40
- let(:argv) { ["accounts", "list"] }
40
+ let(:argv) { %w(accounts list) }
41
41
 
42
42
  before do
43
43
  config_from_contents(USER_APP_CONFIG_CONTENTS)
@@ -56,7 +56,7 @@ describe "brightbox accounts" do
56
56
  context "(when access token expired)", :vcr do
57
57
  let(:password) { default_test_password }
58
58
 
59
- let(:argv) { ["accounts", "list"] }
59
+ let(:argv) { %w(accounts list) }
60
60
 
61
61
  before do
62
62
  config = config_from_contents(USER_APP_CONFIG_CONTENTS)
@@ -74,7 +74,7 @@ describe "brightbox accounts" do
74
74
  context "(when both tokens expired)", :vcr do
75
75
  let(:password) { default_test_password }
76
76
 
77
- let(:argv) { ["accounts", "list"] }
77
+ let(:argv) { %w(accounts list) }
78
78
 
79
79
  before do
80
80
  config = config_from_contents(USER_APP_CONFIG_CONTENTS)
@@ -93,7 +93,7 @@ describe "brightbox accounts" do
93
93
  context "(when invalid tokens)", :vcr do
94
94
  let(:password) { default_test_password }
95
95
 
96
- let(:argv) { ["accounts", "list"] }
96
+ let(:argv) { %w(accounts list) }
97
97
 
98
98
  before do
99
99
  config = config_from_contents(USER_APP_CONFIG_CONTENTS)
@@ -3,12 +3,12 @@ require "spec_helper"
3
3
  describe "brightbox accounts" do
4
4
 
5
5
  describe "reset_ftp_password" do
6
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
6
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
10
  context "" do
11
- let(:argv) { ["accounts", "reset_ftp_password"] }
11
+ let(:argv) { %w(accounts reset_ftp_password) }
12
12
 
13
13
  it "does not error" do
14
14
  expect { output }.to_not raise_error
@@ -3,12 +3,12 @@ require "spec_helper"
3
3
  describe "brightbox accounts" do
4
4
 
5
5
  describe "show" do
6
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
6
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
10
  context "" do
11
- let(:argv) { ["accounts", "show"] }
11
+ let(:argv) { %w(accounts show) }
12
12
 
13
13
  it "does not error" do
14
14
  expect { output }.to_not raise_error
@@ -3,12 +3,12 @@ require "spec_helper"
3
3
  describe "brightbox cloudips" do
4
4
 
5
5
  describe "create" do
6
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
6
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
10
  context "" do
11
- let(:argv) { ["cloudips", "create"] }
11
+ let(:argv) { %w(cloudips create) }
12
12
 
13
13
  it "does not error" do
14
14
  expect { output }.to_not raise_error
@@ -3,12 +3,12 @@ require "spec_helper"
3
3
  describe "brightbox cloudips" do
4
4
 
5
5
  describe "destroy" do
6
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
6
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
10
  context "" do
11
- let(:argv) { ["cloudips", "destroy"] }
11
+ let(:argv) { %w(cloudips destroy) }
12
12
 
13
13
  it "does not error" do
14
14
  expect { output }.to_not raise_error
@@ -3,12 +3,12 @@ require "spec_helper"
3
3
  describe "brightbox cloudips" do
4
4
 
5
5
  describe "list" do
6
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
6
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
10
  context "" do
11
- let(:argv) { ["cloudips", "list"] }
11
+ let(:argv) { %w(cloudips list) }
12
12
 
13
13
  it "does not error" do
14
14
  expect { output }.to_not raise_error
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  describe "brightbox cloudips" do
4
4
 
5
5
  describe "map" do
6
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
6
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
@@ -15,7 +15,7 @@ describe "brightbox cloudips" do
15
15
  end
16
16
 
17
17
  context "when destination is a server ID", :vcr do
18
- let(:argv) { %w{cloudips map cip-12345 srv-12345} }
18
+ let(:argv) { %w(cloudips map cip-12345 srv-12345) }
19
19
  let(:target) { "int-12345" }
20
20
 
21
21
  it "passes the interface identifier to the API" do
@@ -26,7 +26,7 @@ describe "brightbox cloudips" do
26
26
 
27
27
  context "when destination is another value", :vcr do
28
28
  let(:target) { "res-12345" }
29
- let(:argv) { %w{cloudips map cip-12345 res-12345} }
29
+ let(:argv) { %w(cloudips map cip-12345 res-12345) }
30
30
 
31
31
  it "passes the identifier to the API" do
32
32
  expect_any_instance_of(Brightbox::CloudIP).to receive(:map).with(target)
@@ -3,12 +3,12 @@ require "spec_helper"
3
3
  describe "brightbox cloudips" do
4
4
 
5
5
  describe "show" do
6
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
6
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
10
  context "" do
11
- let(:argv) { ["cloudips", "show"] }
11
+ let(:argv) { %w(cloudips show) }
12
12
 
13
13
  it "does not error" do
14
14
  expect { output }.to_not raise_error
@@ -3,12 +3,12 @@ require "spec_helper"
3
3
  describe "brightbox cloudips" do
4
4
 
5
5
  describe "unmap" do
6
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
6
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
10
  context "" do
11
- let(:argv) { ["cloudips", "unmap"] }
11
+ let(:argv) { %w(cloudips unmap) }
12
12
 
13
13
  it "does not error" do
14
14
  expect { output }.to_not raise_error
@@ -3,12 +3,12 @@ require "spec_helper"
3
3
  describe "brightbox cloudips" do
4
4
 
5
5
  describe "update" do
6
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
6
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
10
  context "" do
11
- let(:argv) { ["cloudips", "update"] }
11
+ let(:argv) { %w(cloudips update) }
12
12
 
13
13
  it "does not error" do
14
14
  expect { output }.to_not raise_error
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  describe "brightbox config" do
4
4
 
5
5
  describe "client_add" do
6
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
6
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
@@ -14,7 +14,7 @@ describe "brightbox config" do
14
14
  let(:default_account) { "acc-12345" }
15
15
 
16
16
  context "" do
17
- let(:argv) { ["config", "client_add"] }
17
+ let(:argv) { %w(config client_add) }
18
18
 
19
19
  it "does not error" do
20
20
  expect { output }.to_not raise_error
@@ -3,12 +3,12 @@ require "spec_helper"
3
3
  describe "brightbox config" do
4
4
 
5
5
  describe "client_default" do
6
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
6
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
10
  context "" do
11
- let(:argv) { ["config", "client_default"] }
11
+ let(:argv) { %w(config client_default) }
12
12
 
13
13
  it "does not error" do
14
14
  expect { output }.to_not raise_error
@@ -3,12 +3,12 @@ require "spec_helper"
3
3
  describe "brightbox config" do
4
4
 
5
5
  describe "client_list" do
6
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
6
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
10
  context "" do
11
- let(:argv) { ["config", "client_list"] }
11
+ let(:argv) { %w(config client_list) }
12
12
 
13
13
  it "does not error" do
14
14
  expect { output }.to_not raise_error
@@ -3,12 +3,12 @@ require "spec_helper"
3
3
  describe "brightbox config" do
4
4
 
5
5
  describe "client_remove" do
6
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
6
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
10
  context "" do
11
- let(:argv) { ["config", "client_remove"] }
11
+ let(:argv) { %w(config client_remove) }
12
12
 
13
13
  it "does not error" do
14
14
  expect { output }.to_not raise_error
@@ -7,7 +7,7 @@ require "spec_helper"
7
7
  describe "brightbox config" do
8
8
 
9
9
  describe "user_add" do
10
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
10
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
11
11
  let(:stdout) { output.stdout }
12
12
  let(:stderr) { output.stderr }
13
13
 
@@ -21,7 +21,7 @@ describe "brightbox config" do
21
21
  let(:client_alias) { email }
22
22
 
23
23
  context "" do
24
- let(:argv) { ["config", "user_add"] }
24
+ let(:argv) { %w(config user_add) }
25
25
 
26
26
  it "does not error" do
27
27
  expect { output }.to_not raise_error
@@ -34,7 +34,7 @@ describe "brightbox config" do
34
34
  before do
35
35
  config_file = File.join(ENV["HOME"], ".brightbox", "config")
36
36
  FileUtils.rm_rf(config_file)
37
- expect(File.exists?(config_file)).to be_false
37
+ expect(File.exist?(config_file)).to be false
38
38
  mock_password_entry(password)
39
39
  end
40
40
 
@@ -92,7 +92,6 @@ describe "brightbox config" do
92
92
  end
93
93
  end
94
94
 
95
-
96
95
  context "when new client is first and only client", :vcr do
97
96
  let(:argv) { ["config", "user_add", email, client_id, secret] }
98
97
 
@@ -207,7 +206,6 @@ describe "brightbox config" do
207
206
  mock_password_entry(password)
208
207
  end
209
208
 
210
-
211
209
  it "does not error" do
212
210
  expect { output }.to_not raise_error
213
211
  expect(stderr).to_not include("ERROR")
@@ -261,7 +259,6 @@ describe "brightbox config" do
261
259
  end
262
260
  end
263
261
 
264
-
265
262
  context "when application has access only one active account", :vcr do
266
263
  # Hardcoded in response, different from single account value
267
264
  let(:default_account) { "acc-33333" }
@@ -2,16 +2,16 @@ require "spec_helper"
2
2
 
3
3
  describe "Firewall policies" do
4
4
  before do
5
- pending "Spec is grabbing global state (from config) and breaking other specs"
5
+ skip "Spec is grabbing global state (from config) and breaking other specs"
6
6
  end
7
7
 
8
8
  describe "update" do
9
- let(:output) { FauxIO.new { Brightbox::run(argv) } }
9
+ let(:output) { FauxIO.new { Brightbox.run(argv) } }
10
10
  let(:stdout) { output.stdout }
11
11
  let(:stderr) { output.stderr }
12
12
 
13
13
  context "when no identifier is given", :vcr do
14
- let(:argv) { ["firewall-policies", "update"] }
14
+ let(:argv) { %w(firewall-policies update) }
15
15
 
16
16
  it "prints error to STDERR" do
17
17
  expect(stderr).to include("ERROR: You must specify the firewall-policy-id to update")
@@ -19,7 +19,7 @@ describe "Firewall policies" do
19
19
  end
20
20
 
21
21
  context "when the policy does not exist", :vcr do
22
- let(:argv) { ["firewall-policies", "update", "-n", "missing", "fwp-12345"] }
22
+ let(:argv) { %w(firewall-policies update -n missing fwp-12345) }
23
23
 
24
24
  it "prints error to STDERR" do
25
25
  expect(stderr).to include("ERROR: Resource not found using supplied identifier")
@@ -32,7 +32,7 @@ describe "Firewall policies" do
32
32
  end
33
33
 
34
34
  after do
35
- #FIXME All specs are pending, why is this trying to run against nil?
35
+ # FIXME: All specs are pending, why is this trying to run against nil?
36
36
  @policy.destroy if @policy
37
37
  end
38
38
 
@@ -45,7 +45,7 @@ describe "Firewall policies" do
45
45
  end
46
46
 
47
47
  it "has updated the resource" do
48
- pending "Fails out of sequence"
48
+ skip "Fails out of sequence"
49
49
  expect { output }.to_not raise_error
50
50
  @updated_policy = Brightbox::FirewallPolicy.find(@policy.id)
51
51
  expect(@updated_policy.attributes[:name]).to eql(name)
@@ -61,7 +61,7 @@ describe "Firewall policies" do
61
61
  end
62
62
 
63
63
  it "has updated the resource" do
64
- pending "Fails out of sequence"
64
+ skip "Fails out of sequence"
65
65
  expect { output }.to_not raise_error
66
66
  @updated_policy = Brightbox::FirewallPolicy.find(@policy.id)
67
67
  expect(@updated_policy.attributes[:description]).to eql(description)