brightbox-cli 0.16.0 → 0.17.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 (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
@@ -21,6 +21,7 @@ module Fog
21
21
  request :vm_reboot
22
22
  request :vm_clone
23
23
  request :vm_destroy
24
+ request :datacenters
24
25
 
25
26
  module Shared
26
27
 
@@ -29,36 +30,52 @@ module Fog
29
30
  attr_reader :vsphere_server
30
31
  attr_reader :vsphere_username
31
32
 
33
+ ATTR_TO_PROP = {
34
+ :id => 'config.instanceUuid',
35
+ :name => 'name',
36
+ :uuid => 'config.uuid',
37
+ :instance_uuid => 'config.instanceUuid',
38
+ :hostname => 'summary.guest.hostName',
39
+ :operatingsystem => 'summary.guest.guestFullName',
40
+ :ipaddress => 'guest.ipAddress',
41
+ :power_state => 'runtime.powerState',
42
+ :connection_state => 'runtime.connectionState',
43
+ :hypervisor => 'runtime.host',
44
+ :tools_state => 'guest.toolsStatus',
45
+ :tools_version => 'guest.toolsVersionStatus',
46
+ :is_a_template => 'config.template',
47
+ }
48
+
32
49
  # Utility method to convert a VMware managed object into an attribute hash.
33
50
  # This should only really be necessary for the real class.
34
51
  # This method is expected to be called by the request methods
35
52
  # in order to massage VMware Managed Object References into Attribute Hashes.
36
53
  def convert_vm_mob_ref_to_attr_hash(vm_mob_ref)
37
54
  return nil unless vm_mob_ref
38
- # A cloning VM doesn't have a configuration yet. Unfortuantely we just get
39
- # a RunTime exception.
40
- begin
41
- is_ready = vm_mob_ref.config ? true : false
42
- rescue RuntimeError
43
- is_ready = nil
55
+
56
+ props = vm_mob_ref.collect! *ATTR_TO_PROP.values.uniq
57
+ # NOTE: Object.tap is in 1.8.7 and later.
58
+ # Here we create the hash object that this method returns, but first we need
59
+ # to add a few more attributes that require additional calls to the vSphere
60
+ # API. The hypervisor name and mac_addresses attributes may not be available
61
+ # so we need catch any exceptions thrown during lookup and set them to nil.
62
+ #
63
+ # The use of the "tap" method here is a convience, it allows us to update the
64
+ # hash object without expliclty returning the hash at the end of the method.
65
+ Hash[ATTR_TO_PROP.map { |k,v| [k.to_s, props[v]] }].tap do |attrs|
66
+ attrs['id'] ||= vm_mob_ref._ref
67
+ attrs['mo_ref'] = vm_mob_ref._ref
68
+ # The name method "magically" appears after a VM is ready and
69
+ # finished cloning.
70
+ if attrs['hypervisor'].kind_of?(RbVmomi::VIM::HostSystem) then
71
+ # If it's not ready, set the hypervisor to nil
72
+ attrs['hypervisor'] = attrs['hypervisor'].name rescue nil
73
+ end
74
+ # This inline rescue catches any standard error. While a VM is
75
+ # cloning, a call to the macs method will throw and NoMethodError
76
+ attrs['mac_addresses'] = vm_mob_ref.macs rescue nil
77
+ attrs['path'] = get_folder_path(vm_mob_ref.parent)
44
78
  end
45
- {
46
- 'id' => is_ready ? vm_mob_ref.config.instanceUuid : vm_mob_ref._ref,
47
- 'mo_ref' => vm_mob_ref._ref,
48
- 'name' => vm_mob_ref.name,
49
- 'uuid' => is_ready ? vm_mob_ref.config.uuid : nil,
50
- 'instance_uuid' => is_ready ? vm_mob_ref.config.instanceUuid : nil,
51
- 'hostname' => vm_mob_ref.summary.guest.hostName,
52
- 'operatingsystem' => vm_mob_ref.summary.guest.guestFullName,
53
- 'ipaddress' => vm_mob_ref.summary.guest.ipAddress,
54
- 'power_state' => vm_mob_ref.runtime.powerState,
55
- 'connection_state' => vm_mob_ref.runtime.connectionState,
56
- 'hypervisor' => vm_mob_ref.runtime.host ? vm_mob_ref.runtime.host.name : nil,
57
- 'tools_state' => vm_mob_ref.summary.guest.toolsStatus,
58
- 'tools_version' => vm_mob_ref.summary.guest.toolsVersionStatus,
59
- 'mac_addresses' => is_ready ? vm_mob_ref.macs : nil,
60
- 'is_a_template' => is_ready ? vm_mob_ref.config.template : nil
61
- }
62
79
  end
63
80
 
64
81
  end
@@ -68,6 +85,7 @@ module Fog
68
85
  include Shared
69
86
 
70
87
  def initialize(options={})
88
+ require 'rbvmomi'
71
89
  @vsphere_username = options[:vsphere_username]
72
90
  @vsphere_password = 'REDACTED'
73
91
  @vsphere_server = options[:vsphere_server]
@@ -33,6 +33,7 @@ module Fog
33
33
  attribute :is_a_template
34
34
  attribute :connection_state
35
35
  attribute :mo_ref
36
+ attribute :path
36
37
 
37
38
  def start(options = {})
38
39
  requires :instance_uuid
@@ -56,6 +57,24 @@ module Fog
56
57
  connection.vm_destroy('instance_uuid' => instance_uuid)
57
58
  end
58
59
 
60
+ def clone(options = {})
61
+ requires :name, :path
62
+ # Convert symbols to strings
63
+ req_options = options.inject({}) { |hsh, (k,v)| hsh[k.to_s] = v; hsh }
64
+ # Give our path to the request
65
+ req_options['path'] ="#{path}/#{name}"
66
+ # Perform the actual clone
67
+ clone_results = connection.vm_clone(req_options)
68
+ # Create the new VM model.
69
+ new_vm = self.class.new(clone_results['vm_attributes'])
70
+ # We need to assign the collection and the connection otherwise we
71
+ # cannot reload the model.
72
+ new_vm.collection = self.collection
73
+ new_vm.connection = self.connection
74
+ # Return the new VM model.
75
+ new_vm
76
+ end
77
+
59
78
  end
60
79
 
61
80
  end
@@ -9,8 +9,14 @@ module Fog
9
9
 
10
10
  model Fog::Compute::Vsphere::Server
11
11
 
12
- def all
13
- response = connection.list_virtual_machines
12
+ # 'path' => '/Datacenters/vm/Jeff/Templates' will be MUCH faster.
13
+ # than simply listing everything.
14
+ def all(filters = {})
15
+ # REVISIT: I'm not sure if this is the best way to implement search
16
+ # filters on a collection but it does work. I need to study the AWS
17
+ # code more to make sure this matches up.
18
+ filters['folder'] ||= attributes['folder']
19
+ response = connection.list_virtual_machines(filters)
14
20
  load(response['virtual_machines'])
15
21
  end
16
22
 
@@ -0,0 +1,34 @@
1
+ module Fog
2
+ module Compute
3
+ class Vsphere
4
+ class Real
5
+ def datacenters
6
+ @datacenters ||= datacenters_reload
7
+ # Hide the values which are the RbVmomi instances
8
+ @datacenters.keys
9
+ end
10
+
11
+ private
12
+
13
+ def datacenters_reload
14
+ @rootfolder ||= @connection.rootFolder
15
+ inventory = @rootfolder.inventory(:Datacenter => [ 'name' ])[@rootfolder]
16
+ # Convert the inventory into a Hash of the form: We remove the
17
+ # property selectors. { "<dc_name>" => #<RbVmomi::VIM::Datacenter> }
18
+ # The Datacenter instance itself is at index 0 and the properties we
19
+ # collected are at index 1.
20
+ inventory.inject({}) do |memo, (name,dc_ary)|
21
+ memo[name] = dc_ary[0]
22
+ memo
23
+ end
24
+ end
25
+ end
26
+
27
+ class Mock
28
+ def datacenters
29
+ [ "Solutions", "Solutions2", "Solutions3" ]
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,13 +1,15 @@
1
1
  module Fog
2
2
  module Compute
3
3
  class Vsphere
4
-
5
4
  class Real
6
-
7
5
  def list_virtual_machines(options = {})
8
- # First, determine if there's a search filter
6
+ # Listing all VM's can be quite slow and expensive. Try and optimize
7
+ # based on the available options we have. These conditions are in
8
+ # ascending order of time to complete for large deployments.
9
9
  if options['instance_uuid'] then
10
10
  list_all_virtual_machines_by_instance_uuid(options)
11
+ elsif options['folder'] then
12
+ list_all_virtual_machines_in_folder(options)
11
13
  else
12
14
  list_all_virtual_machines
13
15
  end
@@ -15,6 +17,48 @@ module Fog
15
17
 
16
18
  private
17
19
 
20
+ def list_all_virtual_machines_in_folder(options = {})
21
+ # Tap gets rid of the leading empty string and "Datacenters" element
22
+ # and returns the array.
23
+ path_elements = options['folder'].split('/').tap { |ary| ary.shift 2 }
24
+ # The DC name itself.
25
+ dc_name = path_elements.shift
26
+ # If the first path element contains "vm" this denotes the vmFolder
27
+ # and needs to be shifted out since each DC contains only one
28
+ # vmFolder
29
+ path_elements.shift if path_elements[0] = 'vm'
30
+ # Make sure @datacenters is populated (the keys are DataCenter instances)
31
+ self.datacenters.include? dc_name or raise ArgumentError, "Could not find a Datacenter named #{dc_name}"
32
+ # Get the datacenter managed object
33
+ dc = @datacenters[dc_name]
34
+
35
+ # Get the VM Folder (Group) efficiently
36
+ vm_folder = dc.vmFolder
37
+
38
+ # Walk the tree resetting the folder pointer as we go
39
+ folder = path_elements.inject(vm_folder) do |current_folder, sub_folder_name|
40
+ # JJM VIM::Folder#find appears to be quite efficient as it uses the
41
+ # searchIndex It certainly appears to be faster than
42
+ # VIM::Folder#inventory since that returns _all_ managed objects of
43
+ # a certain type _and_ their properties.
44
+ sub_folder = current_folder.find(sub_folder_name, RbVmomi::VIM::Folder)
45
+ raise ArgumentError, "Could not descend into #{sub_folder_name}. Please check your path." unless sub_folder
46
+ sub_folder
47
+ end
48
+
49
+ # This should be efficient since we're not obtaining properties
50
+ virtual_machines = folder.children.inject([]) do |ary, child|
51
+ if child.is_a? RbVmomi::VIM::VirtualMachine then
52
+ ary << convert_vm_mob_ref_to_attr_hash(child)
53
+ end
54
+ ary
55
+ end
56
+
57
+ # Return the managed objects themselves as an array. These may be converted
58
+ # to an attribute has using convert_vm_mob_ref_to_attr_hash
59
+ { 'virtual_machines' => virtual_machines }
60
+ end
61
+
18
62
  def list_all_virtual_machines_by_instance_uuid(options = {})
19
63
  uuid = options['instance_uuid']
20
64
  search_filter = { :uuid => uuid, 'vmSearch' => true, 'instanceUuid' => true }
@@ -34,6 +78,7 @@ module Fog
34
78
  { 'virtual_machines' => virtual_machines }
35
79
  end
36
80
 
81
+
37
82
  # NOTE: This is a private instance method required by the vm_clone
38
83
  # request. It's very hard to get the Managed Object Reference
39
84
  # of a Template because we can't search for it by instance_uuid
@@ -45,19 +90,50 @@ module Fog
45
90
  datacenters = @connection.rootFolder.children.find_all do |child|
46
91
  child.kind_of? RbVmomi::VIM::Datacenter
47
92
  end
48
- # Next, look in the "vmFolder" of each data center:
93
+ # Next, search the "vmFolder" inventory of each data center:
49
94
  datacenters.each do |dc|
50
- dc.vmFolder.children.each do |vm|
51
- virtual_machines << vm
95
+ inventory = dc.vmFolder.inventory( 'VirtualMachine' => :all )
96
+ virtual_machines << find_all_in_inventory(inventory, :type => RbVmomi::VIM::VirtualMachine, :property => 'name' )
97
+ end
98
+
99
+ virtual_machines.flatten
100
+ end
101
+
102
+ def find_all_in_inventory(inventory, properties = { :type => RbVmomi::VIM::VirtualMachine, :property => nil } )
103
+ results = Array.new
104
+
105
+ inventory.each do |k,v|
106
+
107
+ # If we have a VMware folder we need to traverse the directory
108
+ # to ensure we pick VMs inside folders. So we do a bit of recursion
109
+ # here.
110
+ results << find_all_in_inventory(v) if k.is_a? RbVmomi::VIM::Folder
111
+
112
+ if v[0].is_a? properties[:type]
113
+ if properties[:property].nil?
114
+ results << v[0]
115
+ else
116
+ results << v[1][properties[:property]]
117
+ end
52
118
  end
53
119
  end
54
- virtual_machines
120
+ results.flatten
55
121
  end
56
122
 
123
+ def get_folder_path(folder, root = nil)
124
+ if ( not folder.methods.include?('parent') ) or ( folder == root )
125
+ return
126
+ end
127
+ "#{get_folder_path(folder.parent)}/#{folder.name}"
128
+ end
57
129
  end
58
130
 
59
131
  class Mock
60
132
 
133
+ def get_folder_path(folder, root = nil)
134
+ nil
135
+ end
136
+
61
137
  def list_virtual_machines(options = {})
62
138
  case options['instance_uuid']
63
139
  when nil
@@ -154,10 +230,7 @@ module Fog
154
230
  { 'virtual_machines' => [] }
155
231
  end
156
232
  end
157
-
158
233
  end
159
-
160
234
  end
161
235
  end
162
236
  end
163
-
@@ -6,14 +6,19 @@ module Fog
6
6
  private
7
7
  def vm_clone_check_options(options)
8
8
  options = { 'force' => false }.merge(options)
9
- required_options = %w{ instance_uuid name }
9
+ required_options = %w{ path name }
10
10
  required_options.each do |param|
11
11
  raise ArgumentError, "#{required_options.join(', ')} are required" unless options.has_key? param
12
12
  end
13
- # First, figure out if there's already a VM of the same name.
14
- all_virtual_machines = list_virtual_machines['virtual_machines']
15
- if not options['force'] and all_virtual_machines.detect { |vm| vm['name'] == options['name'] } then
16
- raise Fog::Vsphere::Errors::ServiceError, "A VM already exists with name #{options['name']}"
13
+ # The tap removes the leading empty string
14
+ path_elements = options['path'].split('/').tap { |o| o.shift }
15
+ first_folder = path_elements.shift
16
+ if first_folder != 'Datacenters' then
17
+ raise ArgumentError, "vm_clone path option must start with /Datacenters. Got: #{options['path']}"
18
+ end
19
+ dc_name = path_elements.shift
20
+ if not self.datacenters.include? dc_name then
21
+ raise ArgumentError, "Datacenter #{dc_name} does not exist, only datacenters #{self.dacenters.join(",")} are accessible."
17
22
  end
18
23
  options
19
24
  end
@@ -25,23 +30,47 @@ module Fog
25
30
  # Option handling
26
31
  options = vm_clone_check_options(options)
27
32
 
28
- notfound = lambda { raise Fog::Compute::Vsphere::NotFound, "Cloud not find VM template" }
33
+ notfound = lambda { raise Fog::Compute::Vsphere::NotFound, "Could not find VM template" }
29
34
 
30
- # REVISIT: This will have horrible performance for large sites.
31
- # Find the Managed Object reference of the template VM (Wish I could do this with the API)
32
- vm_mob_ref = list_all_virtual_machine_mobs.find(notfound) do |vm|
33
- convert_vm_mob_ref_to_attr_hash(vm)['instance_uuid'] == options['instance_uuid']
35
+ # Find the template in the folder. This is more efficient than
36
+ # searching ALL VM's looking for the template.
37
+ # Tap gets rid of the leading empty string and "Datacenters" element
38
+ # and returns the array.
39
+ path_elements = options['path'].split('/').tap { |ary| ary.shift 2 }
40
+ # The DC name itself.
41
+ template_dc = path_elements.shift
42
+ # If the first path element contains "vm" this denotes the vmFolder
43
+ # and needs to be shifted out
44
+ path_elements.shift if path_elements[0] = 'vm'
45
+ # The template name. The remaining elements are the folders in the
46
+ # datacenter.
47
+ template_name = path_elements.pop
48
+ # Make sure @datacenters is populated. We need the instances from the Hash keys.
49
+ self.datacenters
50
+ # Get the datacenter managed object from the hash
51
+ dc = @datacenters[template_dc]
52
+ # Get the VM Folder (Group) efficiently
53
+ vm_folder = dc.vmFolder
54
+ # Walk the tree resetting the folder pointer as we go
55
+ folder = path_elements.inject(vm_folder) do |current_folder, sub_folder_name|
56
+ # JJM VIM::Folder#find appears to be quite efficient as it uses the
57
+ # searchIndex It certainly appears to be faster than
58
+ # VIM::Folder#inventory since that returns _all_ managed objects of
59
+ # a certain type _and_ their properties.
60
+ sub_folder = current_folder.find(sub_folder_name, RbVmomi::VIM::Folder)
61
+ raise ArgumentError, "Could not descend into #{sub_folder_name}. Please check your path." unless sub_folder
62
+ sub_folder
34
63
  end
35
64
 
36
- # We need to locate the datacenter object to find the
37
- # default resource pool.
38
- container = vm_mob_ref.parent
39
- until container.kind_of? RbVmomi::VIM::Datacenter
40
- container = container.parent
41
- end
42
- dc = container
43
- # With the Datacenter Object we can obtain the resource pool
44
- resource_pool = dc.hostFolder.children.first.resourcePool
65
+ # Now find the template itself using the efficient find method
66
+ vm_mob_ref = folder.find(template_name, RbVmomi::VIM::VirtualMachine)
67
+
68
+ # Now find _a_ resource pool of the template's host (REVISIT: We need
69
+ # to support cloning into a specific RP)
70
+ esx_host = vm_mob_ref.collect!('runtime.host')['runtime.host']
71
+ # The parent of the ESX host itself is a ComputeResource which has a resourcePool
72
+ resource_pool = esx_host.parent.resourcePool
73
+
45
74
  # Next, create a Relocation Spec instance
46
75
  relocation_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(:pool => resource_pool,
47
76
  :transform => options['transform'] || 'sparse')
@@ -50,27 +79,37 @@ module Fog
50
79
  :powerOn => options['power_on'] || true,
51
80
  :template => false)
52
81
  task = vm_mob_ref.CloneVM_Task(:folder => vm_mob_ref.parent, :name => options['name'], :spec => clone_spec)
53
- # REVISIT: The task object contains a reference to the template but does
54
- # not appear to contain a reference to the newly created VM.
55
- # This is a really naive way to find the managed object reference
56
- # of the newly created VM.
57
- tries = 0
58
- new_vm = begin
59
- list_virtual_machines['virtual_machines'].detect(lambda { raise Fog::Vsphere::Errors::NotFound }) do |vm|
60
- vm['name'] == options['name']
61
- end
62
- rescue Fog::Vsphere::Errors::NotFound
63
- tries += 1
64
- if tries <= 10 then
65
- sleep 1
66
- retry
82
+
83
+ # Waiting for the VM to complete allows us to get the VirtulMachine
84
+ # object of the new machine when it's done. It is HIGHLY recommended
85
+ # to set 'wait' => true if your app wants to wait. Otherwise, you're
86
+ # going to have to reload the server model over and over which
87
+ # generates a lot of time consuming API calls to vmware.
88
+ if options['wait'] then
89
+ # REVISIT: It would be awesome to call a block passed to this
90
+ # request to notify the application how far along in the process we
91
+ # are. I'm thinking of updating a progress bar, etc...
92
+ new_vm = task.wait_for_completion
93
+ else
94
+ tries = 0
95
+ new_vm = begin
96
+ # Try and find the new VM (folder.find is quite efficient)
97
+ folder.find(options['name'], RbVmomi::VIM::VirtualMachine) or raise Fog::Vsphere::Errors::NotFound
98
+ rescue Fog::Vsphere::Errors::NotFound
99
+ tries += 1
100
+ if tries <= 10 then
101
+ sleep 15
102
+ retry
103
+ end
104
+ nil
67
105
  end
68
- nil
69
106
  end
107
+
70
108
  # Return hash
71
109
  {
72
- 'vm_ref' => new_vm ? new_vm['mo_ref'] : nil,
73
- 'task_ref' => task._ref
110
+ 'vm_ref' => new_vm ? new_vm._ref : nil,
111
+ 'vm_attributes' => new_vm ? convert_vm_mob_ref_to_attr_hash(new_vm) : {},
112
+ 'task_ref' => task._ref
74
113
  }
75
114
  end
76
115
 
@@ -83,7 +122,7 @@ module Fog
83
122
  options = vm_clone_check_options(options)
84
123
  notfound = lambda { raise Fog::Compute::Vsphere::NotFound, "Cloud not find VM template" }
85
124
  vm_mob_ref = list_virtual_machines['virtual_machines'].find(notfound) do |vm|
86
- vm['instance_uuid'] == options['instance_uuid']
125
+ vm['name'] == options['path'].split("/")[-1]
87
126
  end
88
127
  {
89
128
  'vm_ref' => 'vm-123',
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__), 'fog', 'core')
3
3
  module Fog
4
4
 
5
5
  unless const_defined?(:VERSION)
6
- VERSION = '1.0.0'
6
+ VERSION = '1.1.1'
7
7
  end
8
8
 
9
9
  end
@@ -1,22 +1,24 @@
1
1
  Shindo.tests("AWS::CloudWatch | alarm_data", ['aws', 'cloudwatch']) do
2
2
 
3
+ pending if Fog.mocking?
4
+
3
5
  tests('success') do
4
6
  tests("#all").succeeds do
5
7
  Fog::AWS[:cloud_watch].alarm_data.all
6
8
  end
7
-
9
+
8
10
  alarm_name_prefix = {'AlarmNamePrefix'=>'tmp'}
9
- tests("#all_by_prefix").succeeds do
11
+ tests("#all_by_prefix").succeeds do
10
12
  Fog::AWS[:cloud_watch].alarm_data.all(alarm_name_prefix)
11
13
  end
12
-
14
+
13
15
  namespace = 'AWS/EC2'
14
16
  metric_name = 'CPUUtilization'
15
17
 
16
18
  tests("#get").succeeds do
17
19
  Fog::AWS[:cloud_watch].alarm_data.get(namespace, metric_name).to_json
18
20
  end
19
-
21
+
20
22
  new_attributes = {
21
23
  :alarm_name => 'tmp-alarm',
22
24
  :comparison_operator => 'GreaterThanOrEqualToThreshold',
@@ -30,11 +32,11 @@ Shindo.tests("AWS::CloudWatch | alarm_data", ['aws', 'cloudwatch']) do
30
32
  tests('#new').returns(new_attributes) do
31
33
  Fog::AWS[:cloud_watch].alarm_data.new(new_attributes).attributes
32
34
  end
33
-
35
+
34
36
  tests('#create').returns(new_attributes) do
35
37
  Fog::AWS[:cloud_watch].alarm_data.create(new_attributes).attributes
36
38
  end
37
-
39
+
38
40
  end
39
41
 
40
42
  end
@@ -1,10 +1,12 @@
1
1
  Shindo.tests("AWS::CloudWatch | alarm_histories", ['aws', 'cloudwatch']) do
2
2
 
3
+ pending if Fog.mocking?
4
+
3
5
  tests('success') do
4
6
  tests("#all").succeeds do
5
7
  Fog::AWS[:cloud_watch].alarm_histories.all
6
8
  end
7
-
9
+
8
10
  new_attributes = {
9
11
  :alarm_name => 'tmp-alarm',
10
12
  :end_date => '',
@@ -2,17 +2,10 @@ Shindo.tests("Fog::Compute[:aws] | security_group", ['aws']) do
2
2
 
3
3
  model_tests(Fog::Compute[:aws].security_groups, {:description => 'foggroupdescription', :name => 'foggroupname'}, true)
4
4
 
5
- tests("a group with trailing whitespace") do
6
- @group = Fog::Compute[:aws].security_groups.create(:name => "foggroup with spaces ", :description => " fog group desc ")
7
- test("name is correct") do
8
- @group.name == "foggroup with spaces "
9
- end
10
-
11
- test("description is correct") do
12
- @group.description == " fog group desc "
13
- end
5
+ tests("authorize and revoke helpers") do
6
+ @group = Fog::Compute[:aws].security_groups.create(:name => "foggroup", :description => "fog group desc")
14
7
 
15
- @other_group = Fog::Compute[:aws].security_groups.create(:name => 'other group', :description => 'another group')
8
+ @other_group = Fog::Compute[:aws].security_groups.create(:name => 'fog other group', :description => 'another fog group')
16
9
 
17
10
  test("authorize access by another security group") do
18
11
  @group.authorize_group_and_owner(@other_group.name)
@@ -26,6 +19,18 @@ Shindo.tests("Fog::Compute[:aws] | security_group", ['aws']) do
26
19
  @group.ip_permissions.empty?
27
20
  end
28
21
 
22
+ test("authorize access to a port range") do
23
+ @group.authorize_port_range(5000..6000)
24
+ @group.reload
25
+ @group.ip_permissions.size == 1
26
+ end
27
+
28
+ test("revoke access to a port range") do
29
+ @group.revoke_port_range(5000..6000)
30
+ @group.reload
31
+ @group.ip_permissions.empty?
32
+ end
33
+
29
34
  @other_group.destroy
30
35
  @group.destroy
31
36
  end
@@ -33,7 +33,7 @@ Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do
33
33
 
34
34
  tests('create') do
35
35
  tests('without availability zones') do
36
- elb = Fog::AWS[:elb].load_balancers.create(:id => elb_id)
36
+ elb = Fog::AWS[:elb].load_balancers.create(:id => elb_id, :availability_zones => @availability_zones)
37
37
  tests("availability zones are correct").returns(@availability_zones.sort) { elb.availability_zones.sort }
38
38
  tests("dns names is set").returns(true) { elb.dns_name.is_a?(String) }
39
39
  tests("created_at is set").returns(true) { Time === elb.created_at }
@@ -54,7 +54,7 @@ Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do
54
54
  # Need to sleep here for IAM changes to propgate
55
55
  tests('with ListenerDescriptions') do
56
56
  @certificate = Fog::AWS[:iam].upload_server_certificate(AWS::IAM::SERVER_CERT_PUBLIC_KEY, AWS::IAM::SERVER_CERT_PRIVATE_KEY, @key_name).body['Certificate']
57
- sleep(8) unless Fog.mocking?
57
+ sleep(10) unless Fog.mocking?
58
58
  listeners = [{
59
59
  'Listener' => {
60
60
  'LoadBalancerPort' => 2030, 'InstancePort' => 2030, 'Protocol' => 'HTTP'
@@ -67,7 +67,7 @@ Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do
67
67
  },
68
68
  'PolicyNames' => []
69
69
  }]
70
- elb3 = Fog::AWS[:elb].load_balancers.create(:id => "#{elb_id}-3", 'ListenerDescriptions' => listeners)
70
+ elb3 = Fog::AWS[:elb].load_balancers.create(:id => "#{elb_id}-3", 'ListenerDescriptions' => listeners, :availability_zones => @availability_zones)
71
71
  tests('there are 2 listeners').returns(2) { elb3.listeners.count }
72
72
  tests('instance_port is 2030').returns(2030) { elb3.listeners.first.instance_port }
73
73
  tests('lb_port is 2030').returns(2030) { elb3.listeners.first.lb_port }
@@ -81,7 +81,7 @@ Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do
81
81
  'Listener' => {
82
82
  'LoadBalancerPort' => 443, 'InstancePort' => 80, 'Protocol' => 'HTTPS', "SSLCertificateId" => "fakecert"}
83
83
  }]
84
- Fog::AWS[:elb].load_balancers.create(:id => "#{elb_id}-4", "ListenerDescriptions" => listeners)
84
+ Fog::AWS[:elb].load_balancers.create(:id => "#{elb_id}-4", "ListenerDescriptions" => listeners, :availability_zones => @availability_zones)
85
85
  end
86
86
  end
87
87
 
@@ -18,6 +18,11 @@ Shindo.tests('AWS::CloudFormation | stack requests', ['aws', 'cloudformation'])
18
18
  'StackId' => String
19
19
  }
20
20
 
21
+ @update_stack_format = {
22
+ 'RequestId' => String,
23
+ 'StackId' => String
24
+ }
25
+
21
26
  @get_template_format = {
22
27
  'RequestId' => String,
23
28
  'TemplateBody' => String
@@ -103,6 +108,15 @@ Shindo.tests('AWS::CloudFormation | stack requests', ['aws', 'cloudformation'])
103
108
  ).body
104
109
  end
105
110
 
111
+ tests("update_stack('#{@stack_name}', 'TemplateURL' => '#{@template_url}', Parameters => {'KeyName' => 'cloudformation'})").formats(@update_stack_format) do
112
+ pending if Fog.mocking?
113
+ Fog::AWS[:cloud_formation].update_stack(
114
+ @stack_name,
115
+ 'TemplateURL' => @template_url,
116
+ 'Parameters' => {'KeyName' => 'cloudformation'}
117
+ ).body
118
+ end
119
+
106
120
  tests("get_template('#{@stack_name})").formats(@get_template_format) do
107
121
  pending if Fog.mocking?
108
122
  Fog::AWS[:cloud_formation].get_template(@stack_name).body