You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2012/09/26 13:16:12 UTC
[1/2] git commit: Google: Capture 401 and 409 errors
Updated Branches:
refs/heads/master 24702a9a0 -> 96a2fc0ab
Google: Capture 401 and 409 errors
* Added 'exceptions {}' block to google driver
* InvalidAccessKeyId and InvalidSecurity is now handled using 401 code
* BucketNameUnavailable now handled with 409 (Conflict)
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/96a2fc0a
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/96a2fc0a
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/96a2fc0a
Branch: refs/heads/master
Commit: 96a2fc0ab9107083c82a229af3c0acf794a51bda
Parents: 9fcf277
Author: Michal Fojtik <mf...@redhat.com>
Authored: Wed Sep 26 13:07:44 2012 +0200
Committer: Michal fojtik <mf...@redhat.com>
Committed: Wed Sep 26 13:07:44 2012 +0200
----------------------------------------------------------------------
.../lib/deltacloud/drivers/google/google_driver.rb | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/96a2fc0a/server/lib/deltacloud/drivers/google/google_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/google/google_driver.rb b/server/lib/deltacloud/drivers/google/google_driver.rb
index 12b0bf0..e2f6c5d 100644
--- a/server/lib/deltacloud/drivers/google/google_driver.rb
+++ b/server/lib/deltacloud/drivers/google/google_driver.rb
@@ -202,6 +202,19 @@ class GoogleDriver < Deltacloud::BaseDriver
return true
end
+ exceptions do
+
+ on /(InvalidAccessKeyId|InvalidSecurity)/ do
+ status 401
+ end
+
+ on /BucketNameUnavailable/ do
+ message "Bucket name already taken"
+ status 409
+ end
+
+ end
+
private
def new_client(credentials)