incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1026021 - /incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
Date Thu, 21 Oct 2010 14:56:14 GMT
Author: mfojtik
Date: Thu Oct 21 14:56:14 2010
New Revision: 1026021

URL: http://svn.apache.org/viewvc?rev=1026021&view=rev
Log:
small fix to ec2 driver to ensure imageset is not null before attempting to use

  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"'

Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb?rev=1026021&r1=1026020&r2=1026021&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb Thu Oct 21
14:56:14 2010
@@ -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 )



Mime
View raw message