deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 1/3] EC2: We should return 404 instead of 502 or 500 in case when resource is not available
Date Wed, 01 Feb 2012 13:55:19 GMT
From: Michal Fojtik <mfojtik@redhat.com>


Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/lib/deltacloud/drivers/ec2/ec2_driver.rb |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index 5c1ddcc..ca22397 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
@@ -971,6 +971,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
-- 
1.7.4.4


Mime
View raw message