deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohammed Morsi <mmo...@redhat.com>
Subject [PATCH] small fix to ec2 driver to ensure imageset is not null before attempting to use
Date Mon, 18 Oct 2010 17:16:32 GMT
  Note the only way I could test this through the standard core deployment was
  to change the default 'owner_id' used in the images query in the ec2 driver
  to an account which had no images (eg my ec2 account after I deleted all my
  images). AFAIK the core REST interface doesn't allow 'user_id' to be passed
  in via the client and setting 'id' to something invalid yields another error:
    'Deltacloud::BackendError - Invalid id: "ami-foo"'
---
 server/lib/deltacloud/drivers/ec2/ec2_driver.rb |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index ac6ffce..0e71ea0 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -130,8 +130,11 @@ class EC2Driver < Deltacloud::BaseDriver
       config.merge!({ :owner_id => opts[:owner_id] }) if opts and opts[:owner_id]
     end
     safely do
-      ec2.describe_images(config).imagesSet.item.each do |image|
-        img_arr << convert_image(image)
+      image_set = ec2.describe_images(config).imagesSet
+      unless image_set.nil?
+        image_set.item.each do |image|
+          img_arr << convert_image(image)
+        end
       end
     end
     img_arr = filter_on( img_arr, :architecture, opts )
-- 
1.7.2.3


Mime
View raw message