You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by ma...@apache.org on 2012/06/04 13:24:58 UTC

[4/7] git commit: Fixes issues/bugs from recent modular deltacloud change, especially adds explicit HEAD route for blob metadata HEAD /bucket/blob.

Fixes issues/bugs from recent modular deltacloud change,
especially adds explicit HEAD route for blob metadata
HEAD /bucket/blob.


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

Branch: refs/heads/master
Commit: beb224e13f729cdb839c20961565f4e8eceb25bf
Parents: cb1c9bb
Author: marios <ma...@redhat.com>
Authored: Fri Jun 1 13:12:54 2012 +0300
Committer: marios <ma...@redhat.com>
Committed: Mon Jun 4 14:24:11 2012 +0300

----------------------------------------------------------------------
 server/lib/deltacloud/collections/buckets.rb |   24 ++++++++++++++++++--
 1 files changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/beb224e1/server/lib/deltacloud/collections/buckets.rb
----------------------------------------------------------------------
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