fog 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. data/Rakefile +106 -17
  2. data/bin/fog +1 -1
  3. data/changelog.txt +17 -0
  4. data/docs/_layouts/default.html +2 -1
  5. data/docs/about/contributing.markdown +1 -1
  6. data/docs/compute/index.markdown +104 -0
  7. data/docs/index.markdown +1 -0
  8. data/docs/storage/index.markdown +17 -0
  9. data/fog.gemspec +3 -2
  10. data/lib/fog.rb +1 -1
  11. data/lib/fog/aws/elb.rb +1 -0
  12. data/lib/fog/aws/iam.rb +1 -0
  13. data/lib/fog/aws/rds.rb +1 -0
  14. data/lib/fog/aws/requests/simpledb/batch_put_attributes.rb +5 -5
  15. data/lib/fog/aws/requests/simpledb/create_domain.rb +1 -1
  16. data/lib/fog/aws/requests/simpledb/delete_attributes.rb +3 -3
  17. data/lib/fog/aws/requests/simpledb/delete_domain.rb +1 -1
  18. data/lib/fog/aws/requests/simpledb/domain_metadata.rb +1 -1
  19. data/lib/fog/aws/requests/simpledb/get_attributes.rb +5 -5
  20. data/lib/fog/aws/requests/simpledb/list_domains.rb +2 -2
  21. data/lib/fog/aws/requests/simpledb/put_attributes.rb +6 -6
  22. data/lib/fog/aws/ses.rb +1 -0
  23. data/lib/fog/aws/simpledb.rb +8 -2
  24. data/lib/fog/bin.rb +2 -2
  25. data/lib/fog/cdn/aws.rb +8 -2
  26. data/lib/fog/cdn/rackspace.rb +8 -2
  27. data/lib/fog/compute/aws.rb +12 -3
  28. data/lib/fog/compute/bluebox.rb +8 -2
  29. data/lib/fog/compute/ecloud.rb +9 -4
  30. data/lib/fog/compute/go_grid.rb +8 -2
  31. data/lib/fog/compute/linode.rb +38 -6
  32. data/lib/fog/compute/models/aws/volumes.rb +4 -4
  33. data/lib/fog/compute/models/bluebox/server.rb +3 -3
  34. data/lib/fog/compute/models/brightbox/server.rb +9 -9
  35. data/lib/fog/compute/models/linode/data_center.rb +12 -0
  36. data/lib/fog/compute/models/linode/data_centers.rb +26 -0
  37. data/lib/fog/compute/models/linode/disk.rb +62 -0
  38. data/lib/fog/compute/models/linode/disks.rb +40 -0
  39. data/lib/fog/compute/models/linode/flavor.rb +23 -0
  40. data/lib/fog/compute/models/linode/flavors.rb +32 -0
  41. data/lib/fog/compute/models/linode/image.rb +14 -0
  42. data/lib/fog/compute/models/linode/images.rb +33 -0
  43. data/lib/fog/compute/models/linode/ip.rb +30 -0
  44. data/lib/fog/compute/models/linode/ips.rb +40 -0
  45. data/lib/fog/compute/models/linode/kernel.rb +12 -0
  46. data/lib/fog/compute/models/linode/kernels.rb +32 -0
  47. data/lib/fog/compute/models/linode/server.rb +88 -0
  48. data/lib/fog/compute/models/linode/servers.rb +32 -0
  49. data/lib/fog/compute/models/linode/stack_script.rb +13 -0
  50. data/lib/fog/compute/models/linode/stack_scripts.rb +32 -0
  51. data/lib/fog/compute/models/rackspace/server.rb +2 -2
  52. data/lib/fog/compute/models/slicehost/server.rb +2 -2
  53. data/lib/fog/compute/models/voxel/server.rb +3 -3
  54. data/lib/fog/compute/new_servers.rb +8 -2
  55. data/lib/fog/compute/rackspace.rb +8 -2
  56. data/lib/fog/compute/requests/aws/allocate_address.rb +4 -2
  57. data/lib/fog/compute/requests/aws/associate_address.rb +4 -2
  58. data/lib/fog/compute/requests/aws/attach_volume.rb +4 -2
  59. data/lib/fog/compute/requests/aws/authorize_security_group_ingress.rb +5 -3
  60. data/lib/fog/compute/requests/aws/create_image.rb +2 -1
  61. data/lib/fog/compute/requests/aws/create_key_pair.rb +4 -2
  62. data/lib/fog/compute/requests/aws/create_security_group.rb +5 -3
  63. data/lib/fog/compute/requests/aws/create_snapshot.rb +6 -4
  64. data/lib/fog/compute/requests/aws/create_tags.rb +7 -5
  65. data/lib/fog/compute/requests/aws/create_volume.rb +4 -2
  66. data/lib/fog/compute/requests/aws/delete_key_pair.rb +3 -1
  67. data/lib/fog/compute/requests/aws/delete_security_group.rb +4 -2
  68. data/lib/fog/compute/requests/aws/delete_snapshot.rb +3 -1
  69. data/lib/fog/compute/requests/aws/delete_tags.rb +5 -3
  70. data/lib/fog/compute/requests/aws/delete_volume.rb +4 -2
  71. data/lib/fog/compute/requests/aws/deregister_image.rb +2 -0
  72. data/lib/fog/compute/requests/aws/describe_addresses.rb +3 -1
  73. data/lib/fog/compute/requests/aws/describe_availability_zones.rb +2 -0
  74. data/lib/fog/compute/requests/aws/describe_images.rb +3 -1
  75. data/lib/fog/compute/requests/aws/describe_instances.rb +12 -10
  76. data/lib/fog/compute/requests/aws/describe_key_pairs.rb +3 -1
  77. data/lib/fog/compute/requests/aws/describe_regions.rb +2 -0
  78. data/lib/fog/compute/requests/aws/describe_reserved_instances.rb +2 -0
  79. data/lib/fog/compute/requests/aws/describe_reserved_instances_offerings.rb +2 -0
  80. data/lib/fog/compute/requests/aws/describe_security_groups.rb +3 -1
  81. data/lib/fog/compute/requests/aws/describe_snapshots.rb +5 -3
  82. data/lib/fog/compute/requests/aws/describe_tags.rb +2 -0
  83. data/lib/fog/compute/requests/aws/describe_volumes.rb +9 -7
  84. data/lib/fog/compute/requests/aws/detach_volume.rb +3 -1
  85. data/lib/fog/compute/requests/aws/disassociate_address.rb +4 -2
  86. data/lib/fog/compute/requests/aws/get_console_output.rb +3 -1
  87. data/lib/fog/compute/requests/aws/get_password_data.rb +15 -1
  88. data/lib/fog/compute/requests/aws/import_key_pair.rb +4 -2
  89. data/lib/fog/compute/requests/aws/modify_image_attributes.rb +4 -0
  90. data/lib/fog/compute/requests/aws/modify_snapshot_attribute.rb +4 -0
  91. data/lib/fog/compute/requests/aws/monitor_instances.rb +3 -1
  92. data/lib/fog/compute/requests/aws/reboot_instances.rb +4 -2
  93. data/lib/fog/compute/requests/aws/register_image.rb +4 -0
  94. data/lib/fog/compute/requests/aws/release_address.rb +3 -1
  95. data/lib/fog/compute/requests/aws/revoke_security_group_ingress.rb +3 -1
  96. data/lib/fog/compute/requests/aws/run_instances.rb +12 -6
  97. data/lib/fog/compute/requests/aws/start_instances.rb +2 -0
  98. data/lib/fog/compute/requests/aws/stop_instances.rb +2 -0
  99. data/lib/fog/compute/requests/aws/terminate_instances.rb +5 -3
  100. data/lib/fog/compute/requests/aws/unmonitor_instances.rb +3 -1
  101. data/lib/fog/compute/requests/go_grid/grid_image_get.rb +1 -1
  102. data/lib/fog/compute/requests/go_grid/grid_image_list.rb +1 -1
  103. data/lib/fog/compute/requests/linode/avail_datacenters.rb +1 -2
  104. data/lib/fog/compute/requests/linode/avail_distributions.rb +1 -2
  105. data/lib/fog/compute/requests/linode/avail_kernels.rb +6 -5
  106. data/lib/fog/compute/requests/linode/avail_linodeplans.rb +9 -3
  107. data/lib/fog/compute/requests/linode/avail_stackscripts.rb +3 -15
  108. data/lib/fog/compute/requests/linode/linode_boot.rb +15 -0
  109. data/lib/fog/compute/requests/linode/linode_config_create.rb +21 -0
  110. data/lib/fog/compute/requests/linode/linode_config_list.rb +18 -0
  111. data/lib/fog/compute/requests/linode/linode_create.rb +3 -4
  112. data/lib/fog/compute/requests/linode/linode_delete.rb +0 -1
  113. data/lib/fog/compute/requests/linode/linode_disk_create.rb +21 -0
  114. data/lib/fog/compute/requests/linode/linode_disk_createfromdistribution.rb +22 -0
  115. data/lib/fog/compute/requests/linode/linode_disk_createfromstackscript.rb +24 -0
  116. data/lib/fog/compute/requests/linode/linode_disk_delete.rb +19 -0
  117. data/lib/fog/compute/requests/linode/linode_disk_list.rb +19 -0
  118. data/lib/fog/compute/requests/linode/linode_ip_addprivate.rb +15 -0
  119. data/lib/fog/compute/requests/linode/linode_ip_list.rb +19 -0
  120. data/lib/fog/compute/requests/linode/linode_list.rb +0 -1
  121. data/lib/fog/compute/requests/linode/linode_reboot.rb +1 -2
  122. data/lib/fog/compute/requests/linode/linode_shutdown.rb +15 -0
  123. data/lib/fog/compute/requests/linode/linode_update.rb +15 -0
  124. data/lib/fog/compute/requests/linode/stackscript_list.rb +31 -0
  125. data/lib/fog/compute/requests/rackspace/confirm_resized_server.rb +3 -3
  126. data/lib/fog/compute/requests/rackspace/create_image.rb +2 -2
  127. data/lib/fog/compute/requests/rackspace/create_server.rb +2 -2
  128. data/lib/fog/compute/requests/rackspace/delete_image.rb +2 -2
  129. data/lib/fog/compute/requests/rackspace/delete_server.rb +2 -2
  130. data/lib/fog/compute/requests/rackspace/list_images_detail.rb +2 -2
  131. data/lib/fog/compute/requests/rackspace/list_servers_detail.rb +2 -2
  132. data/lib/fog/compute/requests/rackspace/resize_server.rb +4 -4
  133. data/lib/fog/compute/requests/rackspace/revert_resized_server.rb +4 -4
  134. data/lib/fog/compute/slicehost.rb +8 -2
  135. data/lib/fog/compute/storm_on_demand.rb +12 -1
  136. data/lib/fog/compute/voxel.rb +8 -2
  137. data/lib/fog/core/mock.rb +14 -1
  138. data/lib/fog/dns/aws.rb +8 -2
  139. data/lib/fog/dns/bluebox.rb +8 -2
  140. data/lib/fog/dns/dnsimple.rb +15 -3
  141. data/lib/fog/dns/linode.rb +8 -2
  142. data/lib/fog/dns/slicehost.rb +8 -2
  143. data/lib/fog/dns/zerigo.rb +8 -2
  144. data/lib/fog/providers/aws.rb +5 -10
  145. data/lib/fog/providers/linode.rb +0 -3
  146. data/lib/fog/storage.rb +6 -4
  147. data/lib/fog/storage/aws.rb +8 -2
  148. data/lib/fog/storage/google.rb +8 -2
  149. data/lib/fog/storage/local.rb +8 -2
  150. data/lib/fog/storage/models/aws/file.rb +0 -1
  151. data/lib/fog/storage/models/google/file.rb +1 -5
  152. data/lib/fog/storage/models/local/file.rb +1 -1
  153. data/lib/fog/storage/models/rackspace/file.rb +1 -5
  154. data/lib/fog/storage/rackspace.rb +8 -2
  155. data/lib/fog/storage/requests/aws/copy_object.rb +2 -2
  156. data/lib/fog/storage/requests/aws/delete_bucket.rb +3 -3
  157. data/lib/fog/storage/requests/aws/delete_object.rb +1 -1
  158. data/lib/fog/storage/requests/aws/get_bucket.rb +1 -1
  159. data/lib/fog/storage/requests/aws/get_bucket_acl.rb +1 -1
  160. data/lib/fog/storage/requests/aws/get_bucket_location.rb +1 -1
  161. data/lib/fog/storage/requests/aws/get_object.rb +1 -1
  162. data/lib/fog/storage/requests/aws/get_object_acl.rb +1 -1
  163. data/lib/fog/storage/requests/aws/get_request_payment.rb +1 -1
  164. data/lib/fog/storage/requests/aws/get_service.rb +1 -1
  165. data/lib/fog/storage/requests/aws/put_bucket.rb +3 -3
  166. data/lib/fog/storage/requests/aws/put_object.rb +3 -3
  167. data/lib/fog/storage/requests/aws/put_request_payment.rb +1 -1
  168. data/lib/fog/storage/requests/google/copy_object.rb +2 -2
  169. data/lib/fog/storage/requests/google/delete_bucket.rb +3 -3
  170. data/lib/fog/storage/requests/google/delete_object.rb +1 -1
  171. data/lib/fog/storage/requests/google/get_bucket.rb +1 -1
  172. data/lib/fog/storage/requests/google/get_bucket_acl.rb +1 -1
  173. data/lib/fog/storage/requests/google/get_object.rb +1 -1
  174. data/lib/fog/storage/requests/google/get_object_acl.rb +1 -1
  175. data/lib/fog/storage/requests/google/get_service.rb +2 -2
  176. data/lib/fog/storage/requests/google/put_bucket.rb +3 -3
  177. data/lib/fog/storage/requests/google/put_object.rb +3 -3
  178. data/lib/fog/terremark/requests/shared/get_network.rb +1 -1
  179. data/lib/fog/terremark/requests/shared/get_organization.rb +1 -1
  180. data/lib/fog/terremark/requests/shared/get_organizations.rb +1 -1
  181. data/lib/fog/terremark/requests/shared/get_public_ips.rb +1 -1
  182. data/lib/fog/terremark/requests/shared/get_vdc.rb +1 -1
  183. data/lib/fog/terremark/shared.rb +4 -0
  184. data/lib/fog/terremark/vcloud.rb +11 -1
  185. data/spec/ecloud/bin_spec.rb +8 -2
  186. data/spec/ecloud/spec_helper.rb +3 -3
  187. data/tests/compute/helper.rb +1 -3
  188. data/tests/compute/models/aws/server_tests.rb +3 -2
  189. data/tests/compute/requests/aws/instance_tests.rb +12 -9
  190. data/tests/compute/requests/aws/key_pair_tests.rb +1 -1
  191. data/tests/compute/requests/aws/volume_tests.rb +2 -2
  192. data/tests/compute/requests/brightbox/helper.rb +3 -0
  193. data/tests/compute/requests/linode/kernel_tests.rb +27 -0
  194. data/tests/compute/requests/linode/linode_tests.rb +62 -4
  195. data/tests/compute/requests/linode/stackscripts_tests.rb +35 -0
  196. data/tests/compute/requests/rackspace/resize_tests.rb +2 -2
  197. data/tests/compute/requests/voxel/server_tests.rb +1 -0
  198. data/tests/core/credential_tests.rb +7 -2
  199. data/tests/core/parser_tests.rb +1 -1
  200. data/tests/helper.rb +1 -1
  201. data/tests/helpers/compute/server_helper.rb +6 -0
  202. data/tests/helpers/formats_helper.rb +2 -0
  203. data/tests/helpers/mock_helper.rb +8 -1
  204. data/tests/helpers/model_helper.rb +1 -3
  205. data/tests/helpers/responds_to_helper.rb +2 -2
  206. data/tests/storage/helper.rb +1 -1
  207. data/tests/storage/models/directories_tests.rb +8 -4
  208. data/tests/storage/models/directory_test.rb +15 -11
  209. data/tests/storage/models/file_tests.rb +6 -6
  210. data/tests/storage/models/files_tests.rb +5 -5
  211. metadata +105 -55
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module Linode
3
+ class Compute
4
+ class Real
5
+ def linode_config_list(linode_id, config_id=nil, options={})
6
+ if config_id
7
+ options.merge!(:configid => config_id)
8
+ end
9
+ request(
10
+ :expects => 200,
11
+ :method => 'GET',
12
+ :query => { :api_action => 'linode.config.list', :linodeId => linode_id }.merge!(options)
13
+ )
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -5,16 +5,16 @@ module Fog
5
5
 
6
6
  # Creates a linode and assigns you full privileges
7
7
  #
8
- # ==== Parameters
8
+ # ==== Parameters
9
9
  # * datacenter_id<~Integer>: id of datacenter to place new linode in
10
+ # * plan_id<~Integer>: id of plan to boot new linode with
10
11
  # * payment_term<~Integer>: Subscription term in months, in [1, 12, 24]
11
- # * plan_id<~Integer>: id of plan to boot new linode with
12
12
  #
13
13
  # ==== Returns
14
14
  # * response<~Excon::Response>:
15
15
  # * body<~Array>:
16
16
  # TODO: docs
17
- def linode_create(datacenter_id, payment_term, plan_id)
17
+ def linode_create(datacenter_id, plan_id, payment_term)
18
18
  request(
19
19
  :expects => 200,
20
20
  :method => 'GET',
@@ -26,7 +26,6 @@ module Fog
26
26
  }
27
27
  )
28
28
  end
29
-
30
29
  end
31
30
  end
32
31
  end
@@ -21,7 +21,6 @@ module Fog
21
21
  :query => { :api_action => 'linode.delete', :linodeId => linode_id }.merge!(options)
22
22
  )
23
23
  end
24
-
25
24
  end
26
25
  end
27
26
  end
@@ -0,0 +1,21 @@
1
+ module Fog
2
+ module Linode
3
+ class Compute
4
+ class Real
5
+ def linode_disk_create(linode_id, name, type, size)
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :query => {
10
+ :api_action => 'linode.disk.create',
11
+ :linodeId => linode_id,
12
+ :label => name,
13
+ :type => type,
14
+ :size => size
15
+ }
16
+ )
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ module Fog
2
+ module Linode
3
+ class Compute
4
+ class Real
5
+ def linode_disk_createfromdistribution(linode_id, distro_id, name, size, password)
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :query => {
10
+ :api_action => 'linode.disk.createfromdistribution',
11
+ :linodeId => linode_id,
12
+ :distributionId => distro_id,
13
+ :label => name,
14
+ :size => size,
15
+ :rootPass => password
16
+ }
17
+ )
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,24 @@
1
+ module Fog
2
+ module Linode
3
+ class Compute
4
+ class Real
5
+ def linode_disk_createfromstackscript(linode_id, script_id, distro_id, name, size, password, options={})
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :query => {
10
+ :api_action => 'linode.disk.createfromstackscript',
11
+ :linodeId => linode_id,
12
+ :stackScriptID => script_id,
13
+ :distributionId => distro_id,
14
+ :label => name,
15
+ :size => size,
16
+ :rootPass => password,
17
+ :stackScriptUDFResponses => options.to_json
18
+ }
19
+ )
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module Linode
3
+ class Compute
4
+ class Real
5
+ def linode_disk_delete(linode_id, disk_id)
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :query => {
10
+ :api_action => 'linode.disk.delete',
11
+ :linodeId => linode_id,
12
+ :diskId => disk_id
13
+ }
14
+ )
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module Linode
3
+ class Compute
4
+ class Real
5
+ def linode_disk_list(linode_id, disk_id=nil)
6
+ options = {}
7
+ if disk_id
8
+ options.merge!(:diskId => disk_id)
9
+ end
10
+ request(
11
+ :expects => 200,
12
+ :method => 'GET',
13
+ :query => { :api_action => 'linode.disk.list', :linodeId => linode_id }.merge!(options)
14
+ )
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ module Fog
2
+ module Linode
3
+ class Compute
4
+ class Real
5
+ def linode_ip_addprivate(linode_id)
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :query => { :api_action => 'linode.ip.addprivate', :linodeId => linode_id }
10
+ )
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module Linode
3
+ class Compute
4
+ class Real
5
+ def linode_ip_list(linode_id, ip_id=nil)
6
+ options = {}
7
+ if ip_id
8
+ options.merge!(:ipaddressId => ip_id)
9
+ end
10
+ request(
11
+ :expects => 200,
12
+ :method => 'GET',
13
+ :query => { :api_action => 'linode.ip.list', :linodeId => linode_id }.merge!(options)
14
+ )
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -23,7 +23,6 @@ module Fog
23
23
  :query => { :api_action => 'linode.list' }.merge!(options)
24
24
  )
25
25
  end
26
-
27
26
  end
28
27
  end
29
28
  end
@@ -13,7 +13,7 @@ module Fog
13
13
  # ==== Returns
14
14
  # * response<~Excon::Response>:
15
15
  # * body<~Array>:
16
- # TODO: docs
16
+ # TODO: docs
17
17
  def linode_reboot(linode_id, options={})
18
18
  request(
19
19
  :expects => 200,
@@ -21,7 +21,6 @@ module Fog
21
21
  :query => { :api_action => 'linode.reboot', :linodeId => linode_id }.merge!(options)
22
22
  )
23
23
  end
24
-
25
24
  end
26
25
  end
27
26
  end
@@ -0,0 +1,15 @@
1
+ module Fog
2
+ module Linode
3
+ class Compute
4
+ class Real
5
+ def linode_shutdown(linode_id)
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :query => { :api_action => 'linode.shutdown', :linodeId => linode_id }
10
+ )
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Fog
2
+ module Linode
3
+ class Compute
4
+ class Real
5
+ def linode_update(linode_id, options={})
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :query => { :api_action => 'linode.update', :linodeId => linode_id }.merge!(options)
10
+ )
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,31 @@
1
+ module Fog
2
+ module Linode
3
+ class Compute
4
+ class Real
5
+
6
+ # Get available stack scripts
7
+ #
8
+ # ==== Parameters
9
+ # * scriptId<~Integer>: id to limit results to
10
+ #
11
+ # ==== Returns
12
+ # * response<~Excon::Response>:
13
+ # * body<~Array>:
14
+ # TODO: docs
15
+ def stackscript_list(script_id=nil)
16
+ options = {}
17
+ if script_id
18
+ options.merge!(:stackScriptID => script_id)
19
+ end
20
+ result = request(
21
+ :expects => 200,
22
+ :method => 'GET',
23
+ :query => { :api_action => 'stackscript.list' }.merge!(options)
24
+ )
25
+ result.body['DATA'].each { |r| r['DISTRIBUTIONIDLIST'] = r['DISTRIBUTIONIDLIST'].to_s }
26
+ result
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -21,9 +21,9 @@ module Fog
21
21
  response = Excon::Response.new
22
22
  response.status = 204
23
23
 
24
- @data[:servers][server_id].delete('old_flavorId')
25
- @data[:last_modified][:servers][server_id] = Time.now
26
- @data[:servers][server_id]['status'] = 'ACTIVE'
24
+ self.data[:servers][server_id].delete('old_flavorId')
25
+ self.data[:last_modified][:servers][server_id] = Time.now
26
+ self.data[:servers][server_id]['status'] = 'ACTIVE'
27
27
 
28
28
  response
29
29
  end
@@ -50,8 +50,8 @@ module Fog
50
50
  'updated' => now.to_s,
51
51
  }
52
52
 
53
- @data[:last_modified][:images][data['id']] = now
54
- @data[:images][data['id']] = data
53
+ self.data[:last_modified][:images][data['id']] = now
54
+ self.data[:images][data['id']] = data
55
55
  response.body = { 'image' => data.reject {|key, value| !['id', 'name', 'serverId', 'status', 'updated'].include?(key)} }
56
56
  response
57
57
  end
@@ -82,8 +82,8 @@ module Fog
82
82
  'progress' => 0,
83
83
  'status' => 'BUILD'
84
84
  }
85
- @data[:last_modified][:servers][data['id']] = Time.now
86
- @data[:servers][data['id']] = data
85
+ self.data[:last_modified][:servers][data['id']] = Time.now
86
+ self.data[:servers][data['id']] = data
87
87
  response.body = { 'server' => data.merge({'adminPass' => 'password'}) }
88
88
  response
89
89
  end
@@ -27,8 +27,8 @@ module Fog
27
27
  response.status = 409
28
28
  raise(Excon::Errors.status_error({:expects => 202}, response))
29
29
  else
30
- @data[:last_modified][:images].delete(image_id)
31
- @data[:images].delete(image_id)
30
+ self.data[:last_modified][:images].delete(image_id)
31
+ self.data[:images].delete(image_id)
32
32
  response.status = 202
33
33
  end
34
34
  response
@@ -27,8 +27,8 @@ module Fog
27
27
  response.status = 409
28
28
  raise(Excon::Errors.status_error({:expects => 202}, response))
29
29
  else
30
- @data[:last_modified][:servers].delete(server_id)
31
- @data[:servers].delete(server_id)
30
+ self.data[:last_modified][:servers].delete(server_id)
31
+ self.data[:servers].delete(server_id)
32
32
  response.status = 202
33
33
  end
34
34
  response
@@ -28,11 +28,11 @@ module Fog
28
28
  def list_images_detail
29
29
  response = Excon::Response.new
30
30
 
31
- images = @data[:images].values
31
+ images = self.data[:images].values
32
32
  for image in images
33
33
  case image['status']
34
34
  when 'SAVING'
35
- if Time.now - @data[:last_modified][:images][image['id']] > Fog::Mock.delay
35
+ if Time.now - self.data[:last_modified][:images][image['id']] >= Fog::Mock.delay
36
36
  image['status'] = 'ACTIVE'
37
37
  end
38
38
  end
@@ -35,11 +35,11 @@ module Fog
35
35
  def list_servers_detail
36
36
  response = Excon::Response.new
37
37
 
38
- servers = @data[:servers].values
38
+ servers = self.data[:servers].values
39
39
  for server in servers
40
40
  case server['status']
41
41
  when 'BUILD'
42
- if Time.now - @data[:last_modified][:servers][server['id']] > 2
42
+ if Time.now - self.data[:last_modified][:servers][server['id']] > Fog::Mock.delay * 2
43
43
  server['status'] = 'ACTIVE'
44
44
  end
45
45
  end
@@ -24,11 +24,11 @@ module Fog
24
24
  response.status = 202
25
25
 
26
26
  # keep track of this for reverts
27
- @data[:servers][server_id]['old_flavorId'] = @data[:servers][server_id]['flavorId']
27
+ self.data[:servers][server_id]['old_flavorId'] = self.data[:servers][server_id]['flavorId']
28
28
 
29
- @data[:servers][server_id]['flavorId'] = flavor_id
30
- @data[:last_modified][:servers][server_id] = Time.now
31
- @data[:servers][server_id]['status'] = 'VERIFY_RESIZE'
29
+ self.data[:servers][server_id]['flavorId'] = flavor_id
30
+ self.data[:last_modified][:servers][server_id] = Time.now
31
+ self.data[:servers][server_id]['status'] = 'VERIFY_RESIZE'
32
32
 
33
33
  response
34
34
  end
@@ -21,10 +21,10 @@ module Fog
21
21
  response = Excon::Response.new
22
22
  response.status = 202
23
23
 
24
- @data[:servers][server_id]['flavorId'] = @data[:servers][server_id]['old_flavorId']
25
- @data[:servers][server_id].delete('old_flavorId')
26
- @data[:last_modified][:servers][server_id] = Time.now
27
- @data[:servers][server_id]['status'] = 'ACTIVE'
24
+ self.data[:servers][server_id]['flavorId'] = self.data[:servers][server_id]['old_flavorId']
25
+ self.data[:servers][server_id].delete('old_flavorId')
26
+ self.data[:last_modified][:servers][server_id] = Time.now
27
+ self.data[:servers][server_id]['status'] = 'ACTIVE'
28
28
 
29
29
  response
30
30
  end
@@ -34,6 +34,10 @@ module Fog
34
34
  end
35
35
  end
36
36
 
37
+ def self.reset
38
+ @data = nil
39
+ end
40
+
37
41
  def initialize(options={})
38
42
  unless options.delete(:provider)
39
43
  location = caller.first
@@ -43,12 +47,14 @@ module Fog
43
47
  end
44
48
 
45
49
  @slicehost_password = options[:slicehost_password]
46
- @data = self.class.data[@slicehost_password]
50
+ end
51
+
52
+ def data
53
+ self.class.data[@slicehost_password]
47
54
  end
48
55
 
49
56
  def reset_data
50
57
  self.class.data.delete(@slicehost_password)
51
- @data = self.class.data[@slicehost_password]
52
58
  end
53
59
 
54
60
  end