brightbox-cli 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (224) hide show
  1. data/README +13 -17
  2. data/README.rdoc +13 -17
  3. data/brightbox-cli.gemspec +1 -1
  4. data/lib/brightbox-cli/accounts.rb +7 -0
  5. data/lib/brightbox-cli/api.rb +3 -0
  6. data/lib/brightbox-cli/commands/config-client-list.rb +1 -1
  7. data/lib/brightbox-cli/commands/firewall-rules-create.rb +4 -0
  8. data/lib/brightbox-cli/commands/firewall-rules-update.rb +49 -0
  9. data/lib/brightbox-cli/commands/groups-show.rb +1 -1
  10. data/lib/brightbox-cli/commands/groups-update.rb +3 -1
  11. data/lib/brightbox-cli/commands/images-destroy.rb +1 -1
  12. data/lib/brightbox-cli/commands/images-list.rb +9 -3
  13. data/lib/brightbox-cli/commands/images-register.rb +1 -1
  14. data/lib/brightbox-cli/commands/images-update.rb +3 -1
  15. data/lib/brightbox-cli/commands/lbs-update.rb +4 -2
  16. data/lib/brightbox-cli/commands/{servers-activate-cloud.rb → servers-activate-console.rb} +2 -1
  17. data/lib/brightbox-cli/commands/servers-update.rb +2 -1
  18. data/lib/brightbox-cli/config.rb +17 -2
  19. data/lib/brightbox-cli/detailed_server.rb +1 -1
  20. data/lib/brightbox-cli/firewall_rule.rb +6 -0
  21. data/lib/brightbox-cli/gli_global_hooks.rb +8 -1
  22. data/lib/brightbox-cli/images.rb +22 -1
  23. data/lib/brightbox-cli/nilable_hash.rb +7 -0
  24. data/lib/brightbox-cli/server_groups.rb +0 -6
  25. data/lib/brightbox-cli/servers.rb +6 -2
  26. data/lib/brightbox-cli/tables.rb +13 -0
  27. data/lib/brightbox-cli/vendor/fog/README.rdoc +2 -9
  28. data/lib/brightbox-cli/vendor/fog/Rakefile +3 -2
  29. data/lib/brightbox-cli/vendor/fog/changelog.txt +213 -0
  30. data/lib/brightbox-cli/vendor/fog/docs/_layouts/default.html +1 -1
  31. data/lib/brightbox-cli/vendor/fog/docs/about/contributing.markdown +1 -1
  32. data/lib/brightbox-cli/vendor/fog/docs/about/getting_started.markdown +28 -3
  33. data/lib/brightbox-cli/vendor/fog/docs/dns/index.markdown +1 -1
  34. data/lib/brightbox-cli/vendor/fog/docs/index.markdown +2 -10
  35. data/lib/brightbox-cli/vendor/fog/docs/storage/index.markdown +2 -2
  36. data/lib/brightbox-cli/vendor/fog/fog.gemspec +6 -5
  37. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/auto_scaling.rb +3 -1
  38. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/cloud_formation.rb +3 -0
  39. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/cloud_watch.rb +3 -1
  40. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/compute.rb +5 -3
  41. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/elb.rb +4 -2
  42. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/emr.rb +133 -0
  43. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/addresses.rb +1 -1
  44. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/key_pairs.rb +1 -1
  45. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/security_groups.rb +1 -1
  46. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/server.rb +4 -2
  47. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/servers.rb +1 -1
  48. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/snapshots.rb +1 -1
  49. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/spot_request.rb +21 -4
  50. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/spot_requests.rb +45 -1
  51. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/compute/volumes.rb +1 -1
  52. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/elb/load_balancer.rb +2 -0
  53. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/models/storage/file.rb +1 -1
  54. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cdn/get_invalidation_list.rb +0 -1
  55. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_formation/update_stack.rb +19 -0
  56. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/emr/add_instance_groups.rb +28 -0
  57. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/emr/add_job_flow_steps.rb +17 -0
  58. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/emr/describe_job_flows.rb +140 -0
  59. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/emr/modify_instance_groups.rb +17 -0
  60. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/emr/run_job_flow.rb +19 -0
  61. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/emr/set_termination_protection.rb +17 -0
  62. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/emr/terminate_job_flows.rb +17 -0
  63. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/rds.rb +3 -1
  64. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/cloud_formation/create_stack.rb +6 -0
  65. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/cloud_formation/update_stack.rb +62 -0
  66. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +141 -36
  67. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/delete_security_group.rb +25 -0
  68. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/delete_tags.rb +1 -1
  69. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_addresses.rb +2 -2
  70. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_availability_zones.rb +5 -2
  71. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_images.rb +1 -1
  72. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_instances.rb +15 -6
  73. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_key_pairs.rb +2 -2
  74. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_regions.rb +2 -2
  75. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_reserved_instances.rb +1 -1
  76. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -2
  77. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_snapshots.rb +4 -4
  78. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/describe_volumes.rb +2 -2
  79. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/modify_instance_attribute.rb +1 -1
  80. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/compute/revoke_security_group_ingress.rb +41 -29
  81. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/elb/describe_load_balancers.rb +3 -3
  82. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb +1 -1
  83. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/emr/add_instance_groups.rb +46 -0
  84. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/emr/add_job_flow_steps.rb +49 -0
  85. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/emr/describe_job_flows.rb +108 -0
  86. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/emr/modify_instance_groups.rb +40 -0
  87. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/emr/run_job_flow.rb +106 -0
  88. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/emr/set_termination_protection.rb +39 -0
  89. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/emr/terminate_job_flows.rb +37 -0
  90. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/simpledb/get_attributes.rb +2 -2
  91. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/simpledb/select.rb +1 -1
  92. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/storage/acl_utils.rb +62 -0
  93. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/storage/get_bucket_acl.rb +7 -1
  94. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/storage/get_object_acl.rb +7 -1
  95. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/storage/get_object_url.rb +2 -2
  96. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/storage/put_bucket_acl.rb +2 -2
  97. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/storage/put_object_acl.rb +1 -1
  98. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/ses.rb +1 -1
  99. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/simpledb.rb +2 -0
  100. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/sns.rb +3 -1
  101. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/sqs.rb +4 -2
  102. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/storage.rb +10 -2
  103. data/lib/brightbox-cli/vendor/fog/lib/fog/aws.rb +26 -1
  104. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/aws.rb +8 -4
  105. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/bluebox.rb +2 -2
  106. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/brightbox.rb +1 -1
  107. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/dnsimple.rb +1 -1
  108. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/dnsmadeeasy.rb +1 -1
  109. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/ecloud.rb +1 -1
  110. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/glesys.rb +1 -1
  111. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/go_grid.rb +1 -1
  112. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/google.rb +1 -1
  113. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/libvirt.rb +1 -1
  114. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/linode.rb +2 -2
  115. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/local.rb +1 -1
  116. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/new_servers.rb +1 -1
  117. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/ninefold.rb +2 -2
  118. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/openstack.rb +1 -1
  119. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/rackspace.rb +3 -3
  120. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/slicehost.rb +1 -1
  121. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/stormondemand.rb +1 -1
  122. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/virtual_box.rb +1 -1
  123. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/vmfusion.rb +1 -1
  124. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/voxel.rb +1 -1
  125. data/lib/brightbox-cli/vendor/fog/lib/fog/bin/zerigo.rb +1 -1
  126. data/lib/brightbox-cli/vendor/fog/lib/fog/bin.rb +1 -1
  127. data/lib/brightbox-cli/vendor/fog/lib/fog/brightbox/compute.rb +2 -0
  128. data/lib/brightbox-cli/vendor/fog/lib/fog/brightbox/models/compute/cloud_ip.rb +10 -2
  129. data/lib/brightbox-cli/vendor/fog/lib/fog/brightbox/models/compute/server.rb +11 -3
  130. data/lib/brightbox-cli/vendor/fog/lib/fog/brightbox/models/compute/server_group.rb +9 -0
  131. data/lib/brightbox-cli/vendor/fog/lib/fog/brightbox/requests/compute/update_firewall_rule.rb +13 -0
  132. data/lib/brightbox-cli/vendor/fog/lib/fog/core/connection.rb +1 -1
  133. data/lib/brightbox-cli/vendor/fog/lib/fog/core/credentials.rb +3 -3
  134. data/lib/brightbox-cli/vendor/fog/lib/fog/core/deprecation.rb +2 -2
  135. data/lib/brightbox-cli/vendor/fog/lib/fog/core/logger.rb +8 -3
  136. data/lib/brightbox-cli/vendor/fog/lib/fog/core/mock.rb +4 -0
  137. data/lib/brightbox-cli/vendor/fog/lib/fog/core/provider.rb +7 -2
  138. data/lib/brightbox-cli/vendor/fog/lib/fog/core/service.rb +8 -2
  139. data/lib/brightbox-cli/vendor/fog/lib/fog/dnsmadeeasy/models/dns/record.rb +3 -2
  140. data/lib/brightbox-cli/vendor/fog/lib/fog/dynect/dns.rb +25 -3
  141. data/lib/brightbox-cli/vendor/fog/lib/fog/ecloud/compute.rb +1 -1
  142. data/lib/brightbox-cli/vendor/fog/lib/fog/go_grid/requests/compute/grid_server_power.rb +1 -1
  143. data/lib/brightbox-cli/vendor/fog/lib/fog/google/models/storage/file.rb +1 -1
  144. data/lib/brightbox-cli/vendor/fog/lib/fog/google/requests/storage/get_object_url.rb +2 -2
  145. data/lib/brightbox-cli/vendor/fog/lib/fog/google/storage.rb +1 -1
  146. data/lib/brightbox-cli/vendor/fog/lib/fog/ninefold/models/storage/file.rb +8 -6
  147. data/lib/brightbox-cli/vendor/fog/lib/fog/ninefold/models/storage/files.rb +3 -2
  148. data/lib/brightbox-cli/vendor/fog/lib/fog/ninefold/requests/storage/head_namespace.rb +20 -0
  149. data/lib/brightbox-cli/vendor/fog/lib/fog/ninefold/storage.rb +4 -2
  150. data/lib/brightbox-cli/vendor/fog/lib/fog/openstack/models/compute/server.rb +7 -1
  151. data/lib/brightbox-cli/vendor/fog/lib/fog/openstack/requests/compute/create_server.rb +6 -11
  152. data/lib/brightbox-cli/vendor/fog/lib/fog/rackspace/load_balancers.rb +1 -0
  153. data/lib/brightbox-cli/vendor/fog/lib/fog/rackspace/models/dns/callback.rb +1 -1
  154. data/lib/brightbox-cli/vendor/fog/lib/fog/rackspace/models/dns/record.rb +1 -1
  155. data/lib/brightbox-cli/vendor/fog/lib/fog/rackspace/models/dns/zone.rb +1 -1
  156. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/dns.rb +1 -0
  157. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/models/dns/record.rb +7 -3
  158. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/models/dns/zone.rb +1 -1
  159. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/parsers/dns/create_record.rb +8 -2
  160. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/parsers/dns/get_record.rb +17 -5
  161. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/parsers/dns/get_records.rb +10 -2
  162. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/requests/dns/get_record.rb +1 -1
  163. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/requests/dns/get_records.rb +7 -8
  164. data/lib/brightbox-cli/vendor/fog/lib/fog/slicehost/requests/dns/update_record.rb +43 -0
  165. data/lib/brightbox-cli/vendor/fog/lib/fog/storm_on_demand/models/compute/balancers.rb +1 -1
  166. data/lib/brightbox-cli/vendor/fog/lib/fog/storm_on_demand/models/compute/configs.rb +1 -1
  167. data/lib/brightbox-cli/vendor/fog/lib/fog/storm_on_demand/models/compute/images.rb +1 -1
  168. data/lib/brightbox-cli/vendor/fog/lib/fog/storm_on_demand/models/compute/servers.rb +1 -1
  169. data/lib/brightbox-cli/vendor/fog/lib/fog/storm_on_demand/models/compute/templates.rb +1 -1
  170. data/lib/brightbox-cli/vendor/fog/lib/fog/terremark/vcloud.rb +1 -1
  171. data/lib/brightbox-cli/vendor/fog/lib/fog/vsphere/compute.rb +41 -23
  172. data/lib/brightbox-cli/vendor/fog/lib/fog/vsphere/models/compute/server.rb +19 -0
  173. data/lib/brightbox-cli/vendor/fog/lib/fog/vsphere/models/compute/servers.rb +8 -2
  174. data/lib/brightbox-cli/vendor/fog/lib/fog/vsphere/requests/compute/datacenters.rb +34 -0
  175. data/lib/brightbox-cli/vendor/fog/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +83 -10
  176. data/lib/brightbox-cli/vendor/fog/lib/fog/vsphere/requests/compute/vm_clone.rb +76 -37
  177. data/lib/brightbox-cli/vendor/fog/lib/fog.rb +1 -1
  178. data/lib/brightbox-cli/vendor/fog/tests/aws/models/cloud_watch/alarm_data_tests.rb +8 -6
  179. data/lib/brightbox-cli/vendor/fog/tests/aws/models/cloud_watch/alarm_history_tests.rb +3 -1
  180. data/lib/brightbox-cli/vendor/fog/tests/aws/models/compute/security_group_tests.rb +15 -10
  181. data/lib/brightbox-cli/vendor/fog/tests/aws/models/elb/model_tests.rb +4 -4
  182. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/cloud_formation/stack_tests.rb +14 -0
  183. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/compute/instance_tests.rb +16 -1
  184. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/compute/security_group_tests.rb +251 -32
  185. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/compute/tag_tests.rb +2 -2
  186. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/emr/helper.rb +172 -0
  187. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/emr/instance_group_tests.rb +106 -0
  188. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/emr/job_flow_tests.rb +88 -0
  189. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/storage/acl_utils_tests.rb +209 -0
  190. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/storage/bucket_tests.rb +80 -55
  191. data/lib/brightbox-cli/vendor/fog/tests/aws/requests/storage/object_tests.rb +42 -24
  192. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/account_tests.rb +11 -6
  193. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/api_client_tests.rb +23 -12
  194. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/cloud_ip_tests.rb +29 -20
  195. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/helper.rb +70 -14
  196. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/image_tests.rb +17 -14
  197. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/interface_tests.rb +3 -2
  198. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/load_balancer_tests.rb +57 -11
  199. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/server_group_tests.rb +29 -22
  200. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/server_tests.rb +38 -21
  201. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/server_type_tests.rb +7 -6
  202. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/user_tests.rb +11 -16
  203. data/lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/zone_tests.rb +7 -6
  204. data/lib/brightbox-cli/vendor/fog/tests/compute/helper.rb +1 -1
  205. data/lib/brightbox-cli/vendor/fog/tests/core/credential_tests.rb +2 -2
  206. data/lib/brightbox-cli/vendor/fog/tests/core/mocking_tests.rb +60 -0
  207. data/lib/brightbox-cli/vendor/fog/tests/dns/models/record_tests.rb +4 -2
  208. data/lib/brightbox-cli/vendor/fog/tests/dns/models/records_tests.rb +4 -2
  209. data/lib/brightbox-cli/vendor/fog/tests/dns/models/zone_tests.rb +3 -1
  210. data/lib/brightbox-cli/vendor/fog/tests/dns/models/zones_tests.rb +4 -2
  211. data/lib/brightbox-cli/vendor/fog/tests/glesys/requests/compute/helper.rb +4 -2
  212. data/lib/brightbox-cli/vendor/fog/tests/glesys/requests/compute/server_tests.rb +1 -1
  213. data/lib/brightbox-cli/vendor/fog/tests/helper.rb +4 -0
  214. data/lib/brightbox-cli/vendor/fog/tests/rackspace/requests/dns/dns_tests.rb +16 -12
  215. data/lib/brightbox-cli/vendor/fog/tests/rackspace/requests/dns/records_tests.rb +13 -11
  216. data/lib/brightbox-cli/vendor/fog/tests/slicehost/requests/dns/dns_tests.rb +58 -11
  217. data/lib/brightbox-cli/vendor/fog/tests/vsphere/compute_tests.rb +18 -10
  218. data/lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/vm_clone_tests.rb +3 -7
  219. data/lib/brightbox-cli/version.rb +1 -1
  220. data/lib/brightbox_cli.rb +1 -0
  221. data/spec/fixtures/vcr_cassettes/list_server_groups.yml +37 -6
  222. data/spec/nilable_hash_spec.rb +30 -0
  223. metadata +48 -18
  224. data/lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/storage/hash_to_acl.rb +0 -44
@@ -7,32 +7,43 @@ Shindo.tests('Fog::Compute[:brightbox] | api client requests', ['brightbox']) do
7
7
  :description => "Description from Fog test"
8
8
  }
9
9
 
10
- tests("#create_api_client(#{create_options.inspect})").formats(Brightbox::Compute::Formats::Full::API_CLIENT) do
10
+ tests("#create_api_client(#{create_options.inspect})") do
11
11
  pending if Fog.mocking?
12
- data = Fog::Compute[:brightbox].create_api_client(create_options)
13
- @api_client_id = data["id"]
14
- data
12
+ result = Fog::Compute[:brightbox].create_api_client(create_options)
13
+ @api_client_id = result["id"]
14
+ formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
15
15
  end
16
16
 
17
- tests("#list_api_clients").formats(Brightbox::Compute::Formats::Collection::API_CLIENTS) do
17
+ tests("#list_api_clients") do
18
18
  pending if Fog.mocking?
19
- Fog::Compute[:brightbox].list_api_clients
19
+ result = Fog::Compute[:brightbox].list_api_clients
20
+ formats(Brightbox::Compute::Formats::Collection::API_CLIENTS) { result }
20
21
  end
21
22
 
22
- tests("#get_api_client('#{@api_client_id}')").formats(Brightbox::Compute::Formats::Full::API_CLIENT) do
23
+ tests("#get_api_client('#{@api_client_id}')") do
23
24
  pending if Fog.mocking?
24
- Fog::Compute[:brightbox].get_api_client(@api_client_id)
25
+ result = Fog::Compute[:brightbox].get_api_client(@api_client_id)
26
+ formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
25
27
  end
26
28
 
27
29
  update_options = {:name => "Fog@#{Time.now.iso8601}"}
28
- tests("#update_api_client('#{@api_client_id}')").formats(Brightbox::Compute::Formats::Full::API_CLIENT) do
30
+ tests("#update_api_client('#{@api_client_id}', #{update_options.inspect})") do
29
31
  pending if Fog.mocking?
30
- Fog::Compute[:brightbox].update_api_client(@api_client_id, update_options)
32
+ result = Fog::Compute[:brightbox].update_api_client(@api_client_id, update_options)
33
+ formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
31
34
  end
32
35
 
33
- tests("#destroy_api_client('#{@api_client_id}')").formats(Brightbox::Compute::Formats::Full::API_CLIENT) do
36
+ tests("#reset_secret_api_client('#{@api_client_id}')") do
34
37
  pending if Fog.mocking?
35
- Fog::Compute[:brightbox].destroy_api_client(@api_client_id)
38
+ result = Fog::Compute[:brightbox].reset_secret_api_client(@api_client_id)
39
+ formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
40
+ test("new secret is visible") { ! result["secret"].nil? }
41
+ end
42
+
43
+ tests("#destroy_api_client('#{@api_client_id}')") do
44
+ pending if Fog.mocking?
45
+ result = Fog::Compute[:brightbox].destroy_api_client(@api_client_id)
46
+ formats(Brightbox::Compute::Formats::Full::API_CLIENT) { result }
36
47
  end
37
48
 
38
49
  end
@@ -3,48 +3,57 @@ Shindo.tests('Fog::Compute[:brightbox] | cloud ip requests', ['brightbox']) do
3
3
  tests('success') do
4
4
 
5
5
  unless Fog.mocking?
6
- @server = Fog::Compute[:brightbox].servers.create(compute_providers[:brightbox][:server_attributes])
6
+ @server = Brightbox::Compute::TestSupport.get_test_server
7
7
  end
8
8
 
9
- tests("#create_cloud_ip").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
9
+ tests("#create_cloud_ip") do
10
10
  pending if Fog.mocking?
11
- data = Fog::Compute[:brightbox].create_cloud_ip
12
- @cloud_ip_id = data["id"]
13
- data
11
+ result = Fog::Compute[:brightbox].create_cloud_ip
12
+ @cloud_ip_id = result["id"]
13
+ formats(Brightbox::Compute::Formats::Full::CLOUD_IP) { result }
14
14
  end
15
15
 
16
- tests("#list_cloud_ips").formats(Brightbox::Compute::Formats::Collection::CLOUD_IPS) do
16
+ tests("#list_cloud_ips") do
17
17
  pending if Fog.mocking?
18
- Fog::Compute[:brightbox].list_cloud_ips
18
+ result = Fog::Compute[:brightbox].list_cloud_ips
19
+ formats(Brightbox::Compute::Formats::Collection::CLOUD_IPS) { result }
19
20
  end
20
21
 
21
- tests("#get_cloud_ip('#{@cloud_ip_id}')").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
22
+ tests("#get_cloud_ip('#{@cloud_ip_id}')") do
22
23
  pending if Fog.mocking?
23
- Fog::Compute[:brightbox].get_cloud_ip(@cloud_ip_id)
24
+ result = Fog::Compute[:brightbox].get_cloud_ip(@cloud_ip_id)
25
+ formats(Brightbox::Compute::Formats::Full::CLOUD_IP) { result }
24
26
  end
25
27
 
26
- unless Fog.mocking?
27
- @server.wait_for { ready? }
28
- map_options = {:interface => @server.interfaces.first["id"]}
29
- end
30
-
31
- tests("#map_cloud_ip('#{@cloud_ip_id}', #{map_options.inspect})").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
28
+ map_options = {:destination => @server.interfaces.first["id"]}
29
+ tests("#map_cloud_ip('#{@cloud_ip_id}', #{map_options.inspect})") do
32
30
  pending if Fog.mocking?
33
- Fog::Compute[:brightbox].map_cloud_ip(@cloud_ip_id, map_options)
31
+ result = Fog::Compute[:brightbox].map_cloud_ip(@cloud_ip_id, map_options)
32
+ formats(Brightbox::Compute::Formats::Full::CLOUD_IP) { result }
34
33
  end
35
34
 
36
35
  unless Fog.mocking?
37
36
  Fog::Compute[:brightbox].cloud_ips.get(@cloud_ip_id).wait_for { mapped? }
38
37
  end
39
38
 
40
- tests("#unmap_cloud_ip('#{@cloud_ip_id}')").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
39
+ tests("#unmap_cloud_ip('#{@cloud_ip_id}')") do
40
+ pending if Fog.mocking?
41
+ result = Fog::Compute[:brightbox].unmap_cloud_ip(@cloud_ip_id)
42
+ formats(Brightbox::Compute::Formats::Full::CLOUD_IP) { result }
43
+ end
44
+
45
+ update_options = {:reverse_dns => "public.#{@server.id}.gb1.brightbox.com"}
46
+ tests("#update_cloud_ip('#{@cloud_ip_id}', #{update_options.inspect})") do
41
47
  pending if Fog.mocking?
42
- Fog::Compute[:brightbox].unmap_cloud_ip(@cloud_ip_id)
48
+ result = Fog::Compute[:brightbox].update_cloud_ip(@cloud_ip_id, update_options)
49
+ formats(Brightbox::Compute::Formats::Full::CLOUD_IP) { result }
50
+ result = Fog::Compute[:brightbox].update_cloud_ip(@cloud_ip_id, {:reverse_dns => ""})
43
51
  end
44
52
 
45
- tests("#destroy_cloud_ip('#{@cloud_ip_id}')").formats(Brightbox::Compute::Formats::Full::CLOUD_IP) do
53
+ tests("#destroy_cloud_ip('#{@cloud_ip_id}')") do
46
54
  pending if Fog.mocking?
47
- Fog::Compute[:brightbox].destroy_cloud_ip(@cloud_ip_id)
55
+ result = Fog::Compute[:brightbox].destroy_cloud_ip(@cloud_ip_id)
56
+ formats(Brightbox::Compute::Formats::Full::CLOUD_IP) { result }
48
57
  end
49
58
 
50
59
  unless Fog.mocking?
@@ -2,6 +2,7 @@ module Fog
2
2
  module Brightbox
3
3
  module Nullable
4
4
  module Account; end
5
+ module FirewallPolicy; end
5
6
  module Image; end
6
7
  module Interface; end
7
8
  module LoadBalancer; end
@@ -14,6 +15,9 @@ end
14
15
  Hash.send :include, Fog::Brightbox::Nullable::Account
15
16
  NilClass.send :include, Fog::Brightbox::Nullable::Account
16
17
 
18
+ Hash.send :include, Fog::Brightbox::Nullable::FirewallPolicy
19
+ NilClass.send :include, Fog::Brightbox::Nullable::FirewallPolicy
20
+
17
21
  Hash.send :include, Fog::Brightbox::Nullable::Image
18
22
  NilClass.send :include, Fog::Brightbox::Nullable::Image
19
23
 
@@ -32,7 +36,28 @@ NilClass.send :include, Fog::Brightbox::Nullable::Zone
32
36
  class Brightbox
33
37
  module Compute
34
38
  module TestSupport
35
- IMAGE_IDENTIFER = "img-2ab98" # Ubuntu Lucid 10.04 server (i686)
39
+ # Find a suitable image for testing with
40
+ # For speed of server building we're using an empty image
41
+ def self.image_id
42
+ return @image_id unless @image_id.nil?
43
+ images = Fog::Compute[:brightbox].list_images
44
+ raise "No available images!" if images.empty?
45
+ image = images.select {|img| img.size == 0 }.first
46
+ image = images.first if image.nil?
47
+ @image_id = image["id"]
48
+ end
49
+
50
+ # Prepare a test server, wait for it to be usable but raise if it fails
51
+ def self.get_test_server
52
+ test_server_options = {:image_id => image_id}
53
+ server = Fog::Compute[:brightbox].servers.create(test_server_options)
54
+ server.wait_for {
55
+ raise "Test server failed to build" if state == "failed"
56
+ ready?
57
+ }
58
+ server
59
+ end
60
+
36
61
  end
37
62
  module Formats
38
63
  module Struct
@@ -84,7 +109,9 @@ class Brightbox
84
109
  "resource_type" => String,
85
110
  "url" => String,
86
111
  "name" => String,
87
- "default" => Fog::Boolean
112
+ "default" => Fog::Boolean,
113
+ "created_at" => String,
114
+ "description" => String
88
115
  }
89
116
 
90
117
  FIREWALL_RULE = {
@@ -110,7 +137,8 @@ class Brightbox
110
137
  "description" => String,
111
138
  "source" => String,
112
139
  "status" => String,
113
- "owner" => String
140
+ "owner" => String,
141
+ "username" => Fog::Nullable::String
114
142
  }
115
143
 
116
144
  INTERFACE = {
@@ -122,6 +150,16 @@ class Brightbox
122
150
  "mac_address" => String
123
151
  }
124
152
 
153
+ LOAD_BALANCER = {
154
+ "id" => String,
155
+ "resource_type" => String,
156
+ "url" => String,
157
+ "name" => String,
158
+ "status" => String,
159
+ "created_at" => String,
160
+ "deleted_at" => Fog::Nullable::String
161
+ }
162
+
125
163
  SERVER = {
126
164
  "id" => String,
127
165
  "resource_type" => String,
@@ -131,7 +169,8 @@ class Brightbox
131
169
  "hostname" => String,
132
170
  "created_at" => String,
133
171
  "started_at" => Fog::Nullable::String,
134
- "deleted_at" => Fog::Nullable::String
172
+ "deleted_at" => Fog::Nullable::String,
173
+ "username" => Fog::Nullable::String
135
174
  }
136
175
 
137
176
  SERVER_GROUP = {
@@ -139,8 +178,10 @@ class Brightbox
139
178
  "resource_type" => String,
140
179
  "url" => String,
141
180
  "name" => String,
181
+ "created_at" => String,
142
182
  "default" => Fog::Boolean,
143
- "description" => Fog::Nullable::String
183
+ "description" => Fog::Nullable::String,
184
+ "created_at" => String
144
185
  }
145
186
 
146
187
  SERVER_TYPE = {
@@ -232,16 +273,17 @@ class Brightbox
232
273
  "source_type" => String,
233
274
  "status" => String,
234
275
  "owner" => String,
276
+ "username" => Fog::Nullable::String,
235
277
  "public" => Fog::Boolean,
236
278
  "official" => Fog::Boolean,
237
279
  "compatibility_mode" => Fog::Boolean,
238
280
  "virtual_size" => Integer,
239
281
  "disk_size" => Integer,
240
- "ancestor" => Fog::Brightbox::Nullable::Image
282
+ "ancestor" => Fog::Brightbox::Nullable::Image,
283
+ "username" => Fog::Nullable::String
241
284
  }
242
285
 
243
286
  LOAD_BALANCER = {
244
- "cloud_ips" => Array,
245
287
  "id" => String,
246
288
  "resource_type" => String,
247
289
  "url" => String,
@@ -249,9 +291,9 @@ class Brightbox
249
291
  "status" => String,
250
292
  "created_at" => String,
251
293
  "deleted_at" => Fog::Nullable::String,
294
+ "cloud_ips" => [Brightbox::Compute::Formats::Nested::CLOUD_IP],
252
295
  "account" => Brightbox::Compute::Formats::Nested::ACCOUNT,
253
- "nodes" => [Brightbox::Compute::Formats::Nested::SERVER],
254
- "cloud_ips" => [Brightbox::Compute::Formats::Nested::CLOUD_IP]
296
+ "nodes" => [Brightbox::Compute::Formats::Nested::SERVER]
255
297
  }
256
298
 
257
299
  SERVER = {
@@ -271,18 +313,22 @@ class Brightbox
271
313
  "server_groups" => [Brightbox::Compute::Formats::Nested::SERVER_GROUP],
272
314
  "snapshots" => [Brightbox::Compute::Formats::Nested::IMAGE],
273
315
  "interfaces" => [Brightbox::Compute::Formats::Nested::INTERFACE],
274
- "zone" => Fog::Brightbox::Nullable::Zone
316
+ "zone" => Fog::Brightbox::Nullable::Zone,
317
+ "username" => Fog::Nullable::String
275
318
  }
276
319
 
277
320
  SERVER_GROUP = {
321
+ "created_at" => String,
278
322
  "id" => String,
279
323
  "resource_type" => String,
280
324
  "url" => String,
281
325
  "name" => String,
282
326
  "description" => Fog::Nullable::String,
283
327
  "default" => Fog::Boolean,
328
+ "created_at" => String,
284
329
  "account" => Brightbox::Compute::Formats::Nested::ACCOUNT,
285
- "servers" => [Brightbox::Compute::Formats::Nested::SERVER]
330
+ "servers" => [Brightbox::Compute::Formats::Nested::SERVER],
331
+ "firewall_policy" => Fog::Brightbox::Nullable::FirewallPolicy
286
332
  }
287
333
 
288
334
  SERVER_TYPE = {
@@ -351,6 +397,10 @@ class Brightbox
351
397
  "users" => [Brightbox::Compute::Formats::Nested::USER],
352
398
  "clients" => [Brightbox::Compute::Formats::Nested::API_CLIENT],
353
399
  "servers" => [Brightbox::Compute::Formats::Nested::SERVER],
400
+ "load_balancers" => [Brightbox::Compute::Formats::Nested::LOAD_BALANCER],
401
+ "cloud_ips" => [Brightbox::Compute::Formats::Nested::CLOUD_IP],
402
+ "server_groups" => [Brightbox::Compute::Formats::Nested::SERVER_GROUP],
403
+ "firewall_policies" => [Brightbox::Compute::Formats::Nested::FIREWALL_POLICY],
354
404
  "images" => [Brightbox::Compute::Formats::Nested::IMAGE],
355
405
  "zones" => [Brightbox::Compute::Formats::Nested::ZONE]
356
406
  }
@@ -415,12 +465,14 @@ class Brightbox
415
465
  "source_type" => String,
416
466
  "status" => String,
417
467
  "owner" => String, # Account ID not object
468
+ "username" => Fog::Nullable::String,
418
469
  "public" => Fog::Boolean,
419
470
  "official" => Fog::Boolean,
420
471
  "compatibility_mode" => Fog::Boolean,
421
472
  "virtual_size" => Integer,
422
473
  "disk_size" => Integer,
423
- "ancestor" => Fog::Brightbox::Nullable::Image
474
+ "ancestor" => Fog::Brightbox::Nullable::Image,
475
+ "username" => Fog::Nullable::String
424
476
  }
425
477
 
426
478
  INTERFACE = {
@@ -470,18 +522,22 @@ class Brightbox
470
522
  "snapshots" => [Brightbox::Compute::Formats::Nested::IMAGE],
471
523
  "server_groups" => [Brightbox::Compute::Formats::Nested::SERVER_GROUP],
472
524
  "interfaces" => [Brightbox::Compute::Formats::Nested::INTERFACE],
473
- "zone" => Brightbox::Compute::Formats::Nested::ZONE
525
+ "zone" => Fog::Brightbox::Nullable::Zone,
526
+ "username" => Fog::Nullable::String
474
527
  }
475
528
 
476
529
  SERVER_GROUP = {
530
+ "created_at" => String,
477
531
  "id" => String,
478
532
  "resource_type" => String,
479
533
  "url" => String,
480
534
  "name" => String,
481
535
  "description" => Fog::Nullable::String,
482
536
  "default" => Fog::Boolean,
537
+ "created_at" => String,
483
538
  "account" => Brightbox::Compute::Formats::Nested::ACCOUNT,
484
- "servers" => [Brightbox::Compute::Formats::Nested::SERVER]
539
+ "servers" => [Brightbox::Compute::Formats::Nested::SERVER],
540
+ "firewall_policy" => Fog::Brightbox::Nullable::FirewallPolicy
485
541
  }
486
542
 
487
543
  SERVER_TYPE = {
@@ -7,35 +7,38 @@ Shindo.tests('Fog::Compute[:brightbox] | image requests', ['brightbox']) do
7
7
  # "arch" => "i686",
8
8
  # "source" => "fnord"
9
9
  # }
10
- # tests("#create_image(#{creation_options.inspect})").formats(Brightbox::Compute::Formats::Full::IMAGE) do
11
- # data = Fog::Compute[:brightbox].create_image(creation_options)
12
- # @image_id = data["id"]
13
- # data
10
+ # tests("#create_image(#{creation_options.inspect})")
11
+ # result = Fog::Compute[:brightbox].create_image(creation_options)
12
+ # @image_id = result["id"]
13
+ # formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
14
14
  # end
15
15
 
16
16
  # Fog::Compute[:brightbox].images.get(@image_id).wait_for { ready? }
17
17
 
18
- tests("#list_images").formats(Brightbox::Compute::Formats::Collection::IMAGES) do
18
+ tests("#list_images") do
19
19
  pending if Fog.mocking?
20
- data = Fog::Compute[:brightbox].list_images
21
- @image_id = data.first["id"]
22
- data
20
+ result = Fog::Compute[:brightbox].list_images
21
+ @image_id = result.first["id"]
22
+ formats(Brightbox::Compute::Formats::Collection::IMAGES) { result }
23
23
  end
24
24
 
25
- tests("#get_image('#{@image_id}')").formats(Brightbox::Compute::Formats::Full::IMAGE) do
25
+ tests("#get_image('#{@image_id}')") do
26
26
  pending if Fog.mocking?
27
- Fog::Compute[:brightbox].get_image(@image_id)
27
+ result = Fog::Compute[:brightbox].get_image(@image_id)
28
+ formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
28
29
  end
29
30
 
30
31
  ## Until Image creation can be automated, we shouldn't be updating Images randomly
31
32
  # update_options = {}
32
- # tests("#update_image('#{@image_id}', #{update_options.inspect})").formats(Brightbox::Compute::Formats::Full::IMAGE) do
33
- # Fog::Compute[:brightbox].update_image(@image_id, :name => "New name from Fog test")
33
+ # tests("#update_image('#{@image_id}', #{update_options.inspect})") do
34
+ # result = Fog::Compute[:brightbox].update_image(@image_id, :name => "New name from Fog test")
35
+ # formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
34
36
  # end
35
37
 
36
38
  ## Same as other tests - can't be deleting them unless part of the test run
37
- # tests("#destroy_server('#{@image_id}')").formats(Brightbox::Compute::Formats::Full::IMAGE) do
38
- # Fog::Compute[:brightbox].destroy_image(@image_id)
39
+ # tests("#destroy_server('#{@image_id}')") do
40
+ # result = Fog::Compute[:brightbox].destroy_image(@image_id)
41
+ # formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
39
42
  # end
40
43
 
41
44
  end
@@ -7,9 +7,10 @@ Shindo.tests('Fog::Compute[:brightbox] | interface requests', ['brightbox']) do
7
7
  @interface_id = server.interfaces.first["id"]
8
8
  end
9
9
 
10
- tests("#get_interface('#{@interface_id}')").formats(Brightbox::Compute::Formats::Full::INTERFACE) do
10
+ tests("#get_interface('#{@interface_id}')") do
11
11
  pending if Fog.mocking?
12
- Fog::Compute[:brightbox].get_interface(@interface_id)
12
+ result = Fog::Compute[:brightbox].get_interface(@interface_id)
13
+ formats(Brightbox::Compute::Formats::Full::INTERFACE) { result }
13
14
  end
14
15
 
15
16
  end
@@ -3,7 +3,7 @@ Shindo.tests('Fog::Compute[:brightbox] | load balancer requests', ['brightbox'])
3
3
  tests('success') do
4
4
 
5
5
  unless Fog.mocking?
6
- @node = Fog::Compute[:brightbox].servers.create(:image_id => Brightbox::Compute::TestSupport::IMAGE_IDENTIFER)
6
+ @node = Brightbox::Compute::TestSupport.get_test_server
7
7
  node_id = @node.id
8
8
  end
9
9
 
@@ -22,34 +22,80 @@ Shindo.tests('Fog::Compute[:brightbox] | load balancer requests', ['brightbox'])
22
22
  }
23
23
  }
24
24
 
25
- tests("#create_load_balancer(#{create_options.inspect})").formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) do
25
+ tests("#create_load_balancer(#{create_options.inspect})") do
26
26
  pending if Fog.mocking?
27
- data = Fog::Compute[:brightbox].create_load_balancer(create_options)
28
- @load_balancer_id = data["id"]
29
- data
27
+ result = Fog::Compute[:brightbox].create_load_balancer(create_options)
28
+ @load_balancer_id = result["id"]
29
+ formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result }
30
30
  end
31
31
 
32
32
  unless Fog.mocking?
33
33
  Fog::Compute[:brightbox].load_balancers.get(@load_balancer_id).wait_for { ready? }
34
34
  end
35
35
 
36
- tests("#list_load_balancers()").formats(Brightbox::Compute::Formats::Collection::LOAD_BALANCERS) do
36
+ tests("#list_load_balancers()") do
37
37
  pending if Fog.mocking?
38
- Fog::Compute[:brightbox].list_load_balancers
38
+ result = Fog::Compute[:brightbox].list_load_balancers
39
+ formats(Brightbox::Compute::Formats::Collection::LOAD_BALANCERS) { result }
39
40
  end
40
41
 
41
- tests("#get_load_balancer('#{@load_balancer_id}')").formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) do
42
+ tests("#get_load_balancer('#{@load_balancer_id}')") do
42
43
  pending if Fog.mocking?
43
- Fog::Compute[:brightbox].get_load_balancer(@load_balancer_id)
44
+ result = Fog::Compute[:brightbox].get_load_balancer(@load_balancer_id)
45
+ formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result }
44
46
  end
45
47
 
46
- tests("#destroy_load_balancer('#{@load_balancer_id}')").formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) do
48
+ update_options = {:name => "New name"}
49
+ tests("#update_load_balancer('#{@load_balancer_id}', #{update_options.inspect})") do
47
50
  pending if Fog.mocking?
48
- Fog::Compute[:brightbox].destroy_load_balancer(@load_balancer_id)
51
+ result = Fog::Compute[:brightbox].update_load_balancer(@load_balancer_id, update_options)
52
+ formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result }
53
+ end
54
+
55
+ add_listeners_options = {:listeners=>[{:out=>28080, :in=>8080, :protocol=>"http"}]}
56
+ tests("#add_listeners_load_balancer('#{@load_balancer_id}', #{add_listeners_options.inspect})") do
57
+ pending if Fog.mocking?
58
+ result = Fog::Compute[:brightbox].add_listeners_load_balancer(@load_balancer_id, add_listeners_options)
59
+ formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result }
60
+ end
61
+
62
+ remove_listeners_options = {:listeners=>[{:out=>28080, :in=>8080, :protocol=>"http"}]}
63
+ tests("#remove_listeners_load_balancer('#{@load_balancer_id}', #{remove_listeners_options.inspect})") do
64
+ pending if Fog.mocking?
65
+ result = Fog::Compute[:brightbox].remove_listeners_load_balancer(@load_balancer_id, remove_listeners_options)
66
+ formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result }
67
+ end
68
+
69
+ unless Fog.mocking?
70
+ @node2 = Brightbox::Compute::TestSupport.get_test_server
71
+ second_node_id = @node2.id
72
+ end
73
+
74
+ # Can't remove the last node so we need to add a second...
75
+ add_nodes_options = {:nodes => [{:node => second_node_id}]}
76
+ tests("#add_nodes_load_balancer('#{@load_balancer_id}', #{add_nodes_options.inspect})") do
77
+ pending if Fog.mocking?
78
+ result = Fog::Compute[:brightbox].add_nodes_load_balancer(@load_balancer_id, add_nodes_options)
79
+ formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result }
80
+ end
81
+
82
+ # ...before we can attempt to remove either
83
+ remove_nodes_options = {:nodes => [{:node => node_id}]}
84
+ tests("#remove_nodes_load_balancer('#{@load_balancer_id}', #{remove_nodes_options.inspect})") do
85
+ pending if Fog.mocking?
86
+ result = Fog::Compute[:brightbox].remove_nodes_load_balancer(@load_balancer_id, remove_nodes_options)
87
+ formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result }
88
+ end
89
+
90
+ tests("#destroy_load_balancer('#{@load_balancer_id}')") do
91
+ pending if Fog.mocking?
92
+ result = Fog::Compute[:brightbox].destroy_load_balancer(@load_balancer_id)
93
+ formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER) { result }
49
94
  end
50
95
 
51
96
  unless Fog.mocking?
52
97
  @node.destroy
98
+ @node2.destroy
53
99
  end
54
100
 
55
101
  end
@@ -3,7 +3,7 @@ Shindo.tests('Fog::Compute[:brightbox] | server group requests', ['brightbox'])
3
3
  tests('success') do
4
4
 
5
5
  unless Fog.mocking?
6
- @server = Fog::Compute[:brightbox].servers.create(:image_id => Brightbox::Compute::TestSupport::IMAGE_IDENTIFER)
6
+ @server = Brightbox::Compute::TestSupport.get_test_server
7
7
  server_id = @server.id
8
8
  end
9
9
 
@@ -14,55 +14,62 @@ Shindo.tests('Fog::Compute[:brightbox] | server group requests', ['brightbox'])
14
14
  }]
15
15
  }
16
16
 
17
- tests("#create_server_group(#{create_options.inspect})").formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) do
17
+ tests("#create_server_group(#{create_options.inspect})") do
18
18
  pending if Fog.mocking?
19
- data = Fog::Compute[:brightbox].create_server_group(create_options)
20
- @server_group_id = data["id"]
21
- data
19
+ result = Fog::Compute[:brightbox].create_server_group(create_options)
20
+ @server_group_id = result["id"]
21
+ formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) { result }
22
22
  end
23
23
 
24
- tests("#list_server_groups").formats(Brightbox::Compute::Formats::Collection::SERVER_GROUPS) do
24
+ tests("#list_server_groups") do
25
25
  pending if Fog.mocking?
26
- Fog::Compute[:brightbox].list_server_groups
26
+ result = Fog::Compute[:brightbox].list_server_groups
27
+ formats(Brightbox::Compute::Formats::Collection::SERVER_GROUPS) { result }
28
+ @default_group_id = result.select {|grp| grp["default"] == true }.first["id"]
27
29
  end
28
30
 
29
- tests("#get_server_group('#{@server_group_id}')").formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) do
31
+ tests("#get_server_group('#{@server_group_id}')") do
30
32
  pending if Fog.mocking?
31
- Fog::Compute[:brightbox].get_server_group(@server_group_id)
33
+ result = Fog::Compute[:brightbox].get_server_group(@server_group_id)
34
+ formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) { result }
32
35
  end
33
36
 
34
37
  update_options = {:name => "Fog@#{Time.now.iso8601}"}
35
- tests("#update_server_group(#{update_options.inspect})").formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) do
38
+ tests("#update_server_group('#{@server_group_id}', #{update_options.inspect})") do
36
39
  pending if Fog.mocking?
37
- Fog::Compute[:brightbox].update_server_group(@server_group_id, update_options)
40
+ result = Fog::Compute[:brightbox].update_server_group(@server_group_id, update_options)
41
+ formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) { result }
38
42
  end
39
43
 
40
44
  remove_options = {:servers => [{:server => server_id}]}
41
- tests("#remove_servers_server_group(#{remove_options.inspect})").formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) do
45
+ tests("#remove_servers_server_group('#{@server_group_id}', #{remove_options.inspect})") do
42
46
  pending if Fog.mocking?
43
- Fog::Compute[:brightbox].remove_servers_server_group(@server_group_id, remove_options)
47
+ result = Fog::Compute[:brightbox].remove_servers_server_group(@server_group_id, remove_options)
48
+ formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) { result }
44
49
  end
45
50
 
46
51
  add_options = {:servers => [{:server => server_id}]}
47
- tests("#add_servers_server_group(#{remove_options.inspect})").formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) do
52
+ tests("#add_servers_server_group('#{@server_group_id}', #{remove_options.inspect})") do
48
53
  pending if Fog.mocking?
49
- Fog::Compute[:brightbox].add_servers_server_group(@server_group_id, add_options)
54
+ result = Fog::Compute[:brightbox].add_servers_server_group(@server_group_id, add_options)
55
+ formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) { result }
50
56
  end
51
57
 
52
- # Server Group must be empty to delete so we need to remove it again
53
- remove_options = {:servers => [{:server => server_id}]}
54
- tests("#remove_servers_server_group(#{remove_options.inspect})").formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) do
58
+ move_options = {:destination => @default_group_id, :servers => [{:server => server_id}]}
59
+ tests("#move_servers_server_group('#{@server_group_id}', #{move_options.inspect})") do
55
60
  pending if Fog.mocking?
56
- Fog::Compute[:brightbox].remove_servers_server_group(@server_group_id, remove_options)
61
+ result = Fog::Compute[:brightbox].move_servers_server_group(@server_group_id, move_options)
62
+ formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) { result }
63
+ test("group is emptied") { result["servers"].empty? }
57
64
  end
58
65
 
59
- tests("#destroy_server_group('#{@server_group_id}')").formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) do
66
+ tests("#destroy_server_group('#{@server_group_id}')") do
60
67
  pending if Fog.mocking?
61
- Fog::Compute[:brightbox].destroy_server_group(@server_group_id)
68
+ result = Fog::Compute[:brightbox].destroy_server_group(@server_group_id)
69
+ formats(Brightbox::Compute::Formats::Full::SERVER_GROUP) { result }
62
70
  end
63
71
 
64
72
  unless Fog.mocking?
65
- @server.wait_for { ready? }
66
73
  @server.destroy
67
74
  end
68
75