[vcloud|compute] create server now takes :catalog_items_uri as an option

This commit is contained in:
Kunal Parikh 2011-06-09 14:53:41 +10:00 committed by Lincoln Stoll
parent ef95bbdf32
commit 5c4ba174e9
3 changed files with 7 additions and 7 deletions

View File

@ -27,10 +27,10 @@ module Fog
nil
end
def create( catalog_item_uri, options )
def create options
check_href!
options[:vdc_uri] = href
data = connection.instantiate_vapp_template( catalog_item_uri, options ).body
data = connection.instantiate_vapp_template(options).body
object = new(data)
object
end

View File

@ -4,9 +4,9 @@ module Fog
module Shared
private
def validate_instantiate_vapp_template_options(catalog_item_uri, options)
def validate_instantiate_vapp_template_options options
# :network_uri removed, if not specified will use template network config.
valid_opts = [:name, :vdc_uri]
valid_opts = [:catalog_item_uri, :name, :vdc_uri]
unless valid_opts.all? { |opt| options.keys.include?(opt) }
raise ArgumentError.new("Required data missing: #{(valid_opts - options.keys).map(&:inspect).join(", ")}")
end
@ -63,8 +63,8 @@ module Fog
class Real
include Shared
def instantiate_vapp_template(catalog_item_uri, options = {})
validate_instantiate_vapp_template_options(catalog_item_uri, options)
def instantiate_vapp_template options = {}
validate_instantiate_vapp_template_options options
request(
:body => generate_instantiate_vapp_template_request(options),

View File

@ -2,7 +2,7 @@ Shindo.tests("Vcloud::Compute | servers", ['vcloud']) do
tests("#server.new('#{Vcloud::Compute::TestSupport::template}')").returns(true) do
pending if Fog.mocking?
@svr = Vcloud.servers.create(Vcloud::Compute::TestSupport::template, :name => 'fog_test_run', :password => 'password')
@svr = Vcloud.servers.create :catalog_item_uri => Vcloud::Compute::TestSupport::template, :name => 'fog_test_run', :password => 'password'
print "Waiting for server to be ready"
@svr.wait_for(1200) { print '.' ; ready? }
puts ""