deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH 3/7] Fixes issues/bugs from recent modular deltacloud change, especially adds explicit HEAD route for blob metadata HEAD /bucket/blob.
Date Fri, 01 Jun 2012 11:24:02 GMT
From: marios <marios@redhat.com>


Signed-off-by: marios <marios@redhat.com>
---
 server/lib/deltacloud/collections/buckets.rb |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/server/lib/deltacloud/collections/buckets.rb b/server/lib/deltacloud/collections/buckets.rb
index ba5af1e..355d4d0 100644
--- a/server/lib/deltacloud/collections/buckets.rb
+++ b/server/lib/deltacloud/collections/buckets.rb
@@ -30,6 +30,24 @@ module Deltacloud::Collections
       end
     end
 
+
+    head route_for('/buckets/:bucket/:blob') do
+      @blob_id = params[:blob]
+      @blob_metadata = driver.blob_metadata(credentials, {:id => params[:blob], 'bucket'
=> params[:bucket]})
+      if @blob_metadata
+        @blob_metadata.each do |k,v|
+          headers["X-Deltacloud-Blobmeta-#{k}"] = v
+        end
+        status 204
+        respond_to do |format|
+          format.xml
+          format.json
+        end
+      else
+        report_error(404)
+      end
+    end
+
     collection :buckets do
 
       standard_show_operation
@@ -162,8 +180,8 @@ module Deltacloud::Collections
 
         action :metadata, :http_method => :head, :with_capability => :blob_metadata
do
           control do
-            @blob_id = params[:blob]
-            @blob_metadata = driver.blob_metadata(credentials, {:id => params[:blob],
'bucket' => params[:bucket]})
+            @blob_id = params[:blob_id]
+            @blob_metadata = driver.blob_metadata(credentials, {:id => params[:blob_id],
'bucket' => params[:id]})
             if @blob_metadata
               @blob_metadata.each do |k,v|
                 headers["X-Deltacloud-Blobmeta-#{k}"] = v
@@ -182,7 +200,7 @@ module Deltacloud::Collections
         action :update, :http_method => :post, :with_capability => :update_blob_metadata
do
           control do
             meta_hash = BlobHelper::extract_blob_metadata_hash(request.env)
-            success = driver.update_blob_metadata(credentials, {'bucket'=>params[:bucket],
:id =>params[:blob], 'meta_hash' => meta_hash})
+            success = driver.update_blob_metadata(credentials, {'bucket'=>params[:id],
:id =>params[:blob_id], 'meta_hash' => meta_hash})
             if(success)
               meta_hash.each do |k,v|
                 headers["X-Deltacloud-Blobmeta-#{k}"] = v
-- 
1.7.6.5


Mime
View raw message