mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[vcloud|compute] create server now takes :catalog_items_uri as an option
This commit is contained in:
parent
ef95bbdf32
commit
5c4ba174e9
3 changed files with 7 additions and 7 deletions
|
@ -27,10 +27,10 @@ module Fog
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def create( catalog_item_uri, options )
|
def create options
|
||||||
check_href!
|
check_href!
|
||||||
options[:vdc_uri] = 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 = new(data)
|
||||||
object
|
object
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,9 +4,9 @@ module Fog
|
||||||
module Shared
|
module Shared
|
||||||
private
|
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.
|
# :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) }
|
unless valid_opts.all? { |opt| options.keys.include?(opt) }
|
||||||
raise ArgumentError.new("Required data missing: #{(valid_opts - options.keys).map(&:inspect).join(", ")}")
|
raise ArgumentError.new("Required data missing: #{(valid_opts - options.keys).map(&:inspect).join(", ")}")
|
||||||
end
|
end
|
||||||
|
@ -63,8 +63,8 @@ module Fog
|
||||||
class Real
|
class Real
|
||||||
include Shared
|
include Shared
|
||||||
|
|
||||||
def instantiate_vapp_template(catalog_item_uri, options = {})
|
def instantiate_vapp_template options = {}
|
||||||
validate_instantiate_vapp_template_options(catalog_item_uri, options)
|
validate_instantiate_vapp_template_options options
|
||||||
|
|
||||||
request(
|
request(
|
||||||
:body => generate_instantiate_vapp_template_request(options),
|
:body => generate_instantiate_vapp_template_request(options),
|
||||||
|
|
|
@ -2,7 +2,7 @@ Shindo.tests("Vcloud::Compute | servers", ['vcloud']) do
|
||||||
|
|
||||||
tests("#server.new('#{Vcloud::Compute::TestSupport::template}')").returns(true) do
|
tests("#server.new('#{Vcloud::Compute::TestSupport::template}')").returns(true) do
|
||||||
pending if Fog.mocking?
|
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"
|
print "Waiting for server to be ready"
|
||||||
@svr.wait_for(1200) { print '.' ; ready? }
|
@svr.wait_for(1200) { print '.' ; ready? }
|
||||||
puts ""
|
puts ""
|
||||||
|
|
Loading…
Add table
Reference in a new issue