deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH] Fix issue with empty realms returned from EC2 ('unavailable' realms shouldn't be reported to client)
Date Fri, 15 Jun 2012 09:35:53 GMT
From: marios <marios@redhat.com>


Signed-off-by: marios <marios@redhat.com>
---
 server/lib/deltacloud/drivers/ec2/ec2_driver.rb |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index 318db1a..7629ffa 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -160,17 +160,19 @@ module Deltacloud
 
         def realms(credentials, opts={})
           ec2 = new_client(credentials)
+          realms = []
           safely do
             if opts[:id] and !opts[:id].empty?
-              return ec2.describe_availability_zones([opts[:id]]).collect do |realm|
-                convert_realm(realm)
+              ec2.describe_availability_zones([opts[:id]]).collect do |realm|
+                realms << convert_realm(realm) unless realm.empty?
               end
             else
-              return ec2.describe_availability_zones.collect do |realm|
-                convert_realm(realm)
+              ec2.describe_availability_zones.collect do |realm|
+                realms << convert_realm(realm) unless realm.empty?
               end
             end
           end
+          realms
         end
 
         def create_image(credentials, opts={})
-- 
1.7.6.5


Mime
View raw message