deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [1/4] git commit: EC2: Fix storage_volumes not return exception on unknown id
Date Mon, 13 Aug 2012 14:39:23 GMT
Updated Branches:
  refs/heads/master 82a3253da -> a2df7f40d


EC2: Fix storage_volumes not return exception on unknown id

* When non-exist storage_volume id was used, the storage_volumes
  returned exception instead of empty arr.


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/a2df7f40
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/a2df7f40
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/a2df7f40

Branch: refs/heads/master
Commit: a2df7f40d8ef7f81660bb3194303783d21504e24
Parents: c487f55
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Mon Aug 13 15:12:24 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Mon Aug 13 16:39:50 2012 +0200

----------------------------------------------------------------------
 server/lib/deltacloud/drivers/ec2/ec2_driver.rb |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a2df7f40/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index 79dd9d2..551bed9 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -627,11 +627,19 @@ module Deltacloud
 
         def storage_snapshots(credentials, opts={})
           ec2 = new_client(credentials)
-          snapshot_list = (opts and opts[:id]) ? [opts[:id]] : []
+          snapshot_list = opts[:id] ? [opts[:id]] : []
           safely do
+            begin
             ec2.describe_snapshots(snapshot_list).collect do |snapshot|
               convert_snapshot(snapshot)
             end
+            rescue => e
+              if e.message =~ /NotFound/
+                []
+              else
+                raise e
+              end
+            end
           end
         end
 


Mime
View raw message