On Dec 14, 2011, at 11:47 AM, [email protected] wrote:

ACK to both. Nicely done Marios. I never though that you can fetch
the list of providers using API. I think this will also make our YAML
file for EC2 obsolete.

  -- Michal


> From: marios <[email protected]>
> 
> 
> Signed-off-by: marios <[email protected]>
> ---
> server/lib/deltacloud/drivers/ec2/ec2_driver.rb |    6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb 
> b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> index 12f4fb3..da2cb3d 100644
> --- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> +++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> @@ -695,6 +695,12 @@ module Deltacloud
>           end
>         end
> 
> +        def providers(credentials, opts={})
> +          ec2 = new_client(credentials)
> +          providers = ec2.describe_regions.map{|r| Provider.new( {:id=>r, 
> :name=>r,
> +           
> :url=>"#{ENV['API_HOST']}:#{ENV['API_PORT']}#{settings.root_url}\;provider=#{r}"
>  }) }
> +        end
> +
>         def valid_credentials?(credentials)
>           retval = true
>           begin
> -- 
> 1.7.6.4
> 

------------------------------------------------------
Michal Fojtik, [email protected]
Deltacloud API: http://deltacloud.org

Reply via email to