1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[vcloud|compute] allow specifying a default VDC uri as 'vcloud_default_vdc'

This will default all operations to this VDC, rather
than requiring it to be specified in the model chain.
This commit is contained in:
Lincoln Stoll 2011-05-26 10:23:49 +10:00
parent fb5c847214
commit 8989b7bc7e
5 changed files with 10 additions and 1 deletions

View file

@ -12,6 +12,7 @@ module Fog
attribute :href
def all
self.href = connection.default_vdc_href unless self.href
check_href!( :messages => "Ips href of a Network you want to enumerate" )
if data = connection.get_network_ips(href).body[:IpAddress]
load(data)

View file

@ -13,6 +13,7 @@ module Fog
attribute :href
def all
self.href = connection.default_vdc_href unless self.href
check_href!("Vdc")
if data = connection.get_vdc(href).body[:AvailableNetworks][:Network]
load(data)

View file

@ -13,6 +13,7 @@ module Fog
attribute :href, :aliases => :Href
def all
self.href = connection.default_vdc_href unless self.href
check_href!(:parent => "Vdc")
load(_vapps)
end

View file

@ -11,6 +11,7 @@ module Fog
attribute :href, :aliases => :Href
def all
self.href = connection.default_vdc_href unless self.href
check_href!
if data = connection.get_task_list(href).body[:Task]
load(data)

View file

@ -534,7 +534,7 @@ module Fog
SCHEME = 'https'
requires :vcloud_username, :vcloud_password, :vcloud_host
recognizes :vcloud_port, :vcloud_scheme, :vcloud_path
recognizes :vcloud_port, :vcloud_scheme, :vcloud_path, :vcloud_default_vdc
recognizes :provider # remove post deprecation
model_path 'fog/compute/models/vcloud'
@ -599,6 +599,10 @@ module Fog
end
end
def default_vdc_href
@vdc_href
end
# login handles the auth, but we just need the Set-Cookie
# header from that call.
def do_login
@ -754,6 +758,7 @@ module Fog
@username = options[:vcloud_username]
@password = options[:vcloud_password]
@host = options[:vcloud_host]
@vdc_href = options[:vcloud_default_vdc]
@path = options[:vcloud_path] || Fog::Vcloud::Compute::PATH
@port = options[:vcloud_port] || Fog::Vcloud::Compute::PORT
@scheme = options[:vcloud_scheme] || Fog::Vcloud::Compute::SCHEME