deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [1/6] git commit: EC2: We should return 404 instead of 502 or 500 in case when resource is not available
Date Tue, 07 Feb 2012 10:12:20 GMT
Updated Branches:
  refs/heads/master 64c4f2af7 -> e60bd6428


EC2: We should return 404 instead of 502 or 500 in case when resource is not available


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

Branch: refs/heads/master
Commit: f66b594398bf92b142b1a35dd0754ef48ff22762
Parents: 64c4f2a
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Wed Feb 1 14:37:45 2012 +0100
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Tue Feb 7 11:13:06 2012 +0100

----------------------------------------------------------------------
 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/f66b5943/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 50bc39f..fa733f0 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -280,7 +280,7 @@ module Deltacloud
           ec2 = new_client(credentials)
           opts ||= {}
           safely do
-            ec2.describe_key_pairs(opts[:id] || nil).collect do |key|
+            ec2.describe_key_pairs(opts[:id] ? [opts[:id]] : nil).collect do |key|
               convert_key(key)
             end
           end
@@ -973,6 +973,14 @@ module Deltacloud
             status 401
           end
 
+          on /(NotFound|InvalidInstanceID|InvalidAMIID)/ do
+            status 404
+          end
+
+          on /Invalid availability zone/ do
+            status 404
+          end
+
           on /Error/ do
             status 502
           end


Mime
View raw message