You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/06/04 12:25:10 UTC

[PATCH core 2/3] EC2: Fixed the way how we handle describe_availability_zones to be 1.9 compatible

From: Michal Fojtik <mf...@redhat.com>


Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/lib/deltacloud/drivers/ec2/ec2_driver.rb |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index f7ef826..6454cce 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -159,10 +159,15 @@ module Deltacloud
 
         def realms(credentials, opts={})
           ec2 = new_client(credentials)
-          zone_id = opts ? opts[:id] : nil
           safely do
-            return ec2.describe_availability_zones(zone_id).collect do |realm|
-              convert_realm(realm)
+            if opts[:id] and !opts[:id].empty?
+              return ec2.describe_availability_zones([opts[:id]]).collect do |realm|
+                convert_realm(realm)
+              end
+            else
+              return ec2.describe_availability_zones.collect do |realm|
+                convert_realm(realm)
+              end
             end
           end
         end
-- 
1.7.10.2