incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1043080 - /incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
Date Tue, 07 Dec 2010 15:06:03 GMT
Author: mfojtik
Date: Tue Dec  7 15:06:02 2010
New Revision: 1043080

URL: http://svn.apache.org/viewvc?rev=1043080&view=rev
Log:
Added safely..do block for Blobs in EC2 driver

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=1043080&r1=1043079&r2=1043080&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 Tue Dec  7
15:06:02 2010
@@ -398,8 +398,10 @@ class EC2Driver < Deltacloud::BaseDriver
 #--
   def blob_data(credentials, bucket_id, blob_id, opts)
     s3_client = s3_client(credentials)
-    s3_client.interface.get(bucket_id, blob_id) do |chunk|
-      yield chunk
+    safely do
+      s3_client.interface.get(bucket_id, blob_id) do |chunk|
+        yield chunk
+      end
     end
   end
 
@@ -410,15 +412,17 @@ class EC2Driver < Deltacloud::BaseDriver
     s3_client = s3_client(credentials)
     #data is a construct with the temporary file created by server @.tempfile
     #also file[:type] will give us the content-type
-    res = s3_client.interface.put(bucket_id, blob_id, data[:tempfile], {"Content-Type" =>
data[:type]})
-    #create a new Blob object and return that
-    Blob.new( { :id => blob_id,
+    safely do
+      res = s3_client.interface.put(bucket_id, blob_id, data[:tempfile], {"Content-Type"
=> data[:type]})
+      #create a new Blob object and return that
+      Blob.new( { :id => blob_id,
                 :bucket => bucket_id,
                 :content_length => data[:tempfile].length,
                 :content_type => data[:type],
                 :last_modified => ''
               }
             )
+    end
   end
 
 #--
@@ -426,7 +430,9 @@ class EC2Driver < Deltacloud::BaseDriver
 #--  
   def delete_blob(credentials, bucket_id, blob_id, opts=nil)
     s3_client = s3_client(credentials)
-    s3_client.interface.delete(bucket_id, blob_id)
+    safely do
+      s3_client.interface.delete(bucket_id, blob_id)
+    end
   end
 
   def load_balancer(credentials, opts={})
@@ -656,8 +662,8 @@ class EC2Driver < Deltacloud::BaseDriver
   def catched_exceptions_list
     {
       :auth => [ AWS::AuthFailure ],
-      :error => [],
-      :glob => [ /AWS::(\w+)/ ]
+      :error => [ RightAws::AwsError ],
+      :glob => [ /.*AWS::(\w+)/ ]
     }
   end
 



Mime
View raw message