mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Added loading of standard image.
Currently not working: Expected(204) <=> Actual(404 Not Found) request => {:connect_timeout=>60, :headers=>{"Authorization"=>"Basic YWE4ZWIxYzktYzc4OC00MDlmLWJmZjQtYjAyMjVjMDE0MDQ1OkFkZ1hYSGVUTmY3TTJHR1l2NEI3WkpnWE1ISkJMY1E2dlJBejRZUUg=", "Accept"=>"application/json", "Host"=>"api.z1-man.serverlove.com:443", "Content-Length"=>0}, :instrumentor_name=>"excon", :mock=>false, :read_timeout=>60, :retry_limit=>4, :ssl_ca_file=>"/Users/seanhandley/.rvm/gems/ruby-1.9.3-p125@fog_gem/gems/excon-0.14.1/data/cacert.pem", :ssl_verify_peer=>true, :write_timeout=>60, :host=>"api.z1-man.serverlove.com", :path=>"/drives/aea15650-5001-4cb8-8146-8c9835f5b880/image/679f5f44-0be7-4745-a658-cccd4334c1aa", :port=>"443", :query=>nil, :scheme=>"https", :method=>"post", :expects=>204} response => #<Excon::Response:0x007ff661811848 @body="Operation failed: drive not found\n", @headers={"Server"=>"BaseHTTP/0.3 Python/2.6.6", "Date"=>"Fri, 22 Jun 2012 15:03:50 GMT", "X-Elastic-Error"=>"missing drive", "Connection"=>"close", "Content-Type"=>"text/plain"}, @status=404> (Excon::Errors::NotFound)
This commit is contained in:
parent
3831f81de7
commit
14efc2f14c
4 changed files with 25 additions and 1 deletions
|
@ -16,6 +16,7 @@ module Fog
|
|||
request :destroy_image
|
||||
request :create_image
|
||||
request :update_image
|
||||
request :load_standard_image
|
||||
|
||||
# Server
|
||||
request :get_servers
|
||||
|
|
|
@ -30,6 +30,11 @@ module Fog
|
|||
self
|
||||
end
|
||||
|
||||
def load_standard_image(standard_image_uuid)
|
||||
requires :identity
|
||||
connection.load_standard_image(identity, standard_image_uuid)
|
||||
end
|
||||
|
||||
def ready?
|
||||
status.upcase == 'ACTIVE'
|
||||
end
|
||||
|
|
13
lib/fog/serverlove/requests/compute/load_standard_image.rb
Normal file
13
lib/fog/serverlove/requests/compute/load_standard_image.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class Serverlove
|
||||
class Real
|
||||
|
||||
def load_standard_image(destination_image, source_image)
|
||||
request(:method => "post", :path => "/drives/#{destination_image}/image/#{source_image}", :expects => 204)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -16,7 +16,7 @@ Shindo.tests('Fog::Compute[:serverlove] | drive requests', ['serverlove']) do
|
|||
|
||||
tests('success') do
|
||||
|
||||
attributes = { name: 'Test', size: 12345 }
|
||||
attributes = { 'name' => 'Test', 'size' => '1234567890' }
|
||||
|
||||
tests("#create_image").formats(@image_format) do
|
||||
@image = Fog::Compute[:serverlove].create_image(attributes).body
|
||||
|
@ -32,6 +32,11 @@ Shindo.tests('Fog::Compute[:serverlove] | drive requests', ['serverlove']) do
|
|||
Fog::Compute[:serverlove].images.get(@image['drive']).name == "Diff"
|
||||
end
|
||||
|
||||
tests("#load_standard_image").succeeds do
|
||||
# Load centos
|
||||
Fog::Compute[:serverlove].load_standard_image(@image['drive'], '679f5f44-0be7-4745-a658-cccd4334c1aa')
|
||||
end
|
||||
|
||||
tests("#destroy_image").succeeds do
|
||||
Fog::Compute[:serverlove].destroy_image(@image['drive'])
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue