On Jul 14, 2011, at 4:58 PM, mar...@redhat.com wrote:

ACK. Sorry for delay ;-)

  -- Michal

> From: marios <mar...@redhat.com>
> 
> 
> Signed-off-by: marios <mar...@redhat.com>
> ---
> server/lib/deltacloud/drivers/ec2/ec2_driver.rb |   18 ++++++++++++++++++
> 1 files changed, 18 insertions(+), 0 deletions(-)
> 
> diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb 
> b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> index 45032d6..175e4ca 100644
> --- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> +++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> @@ -415,6 +415,24 @@ module Deltacloud
>           end
>         end
> 
> +        def blob_metadata(credentials, opts={})
> +          s3_client = new_client(credentials, :s3)
> +          blob_meta = {}
> +          safely do
> +            the_blob = s3_client.bucket(opts['bucket']).key(opts[:id], true)
> +            blob_meta = the_blob.meta_headers
> +          end
> +          blob_meta

Just a minor catch: If you're using 'block' the value returned from it is the 
value of the
last statement in this block. In this case, it's 'blob_meta', so it's safe to 
use just:

def blob_metadata(...)
  ......
  safely do
    .....
    blob_meta = the_blob.meta_headers
  end
end

> +        end
> +
> +        def update_blob_metadata(credentials, opts={})
> +          s3_client = new_client(credentials, :s3)
> +          meta_hash = BlobHelper::rename_metadata_headers(opts['meta_hash'], 
> '')
> +          safely do
> +            the_blob = s3_client.bucket(opts['bucket']).key(opts[:id])
> +            the_blob.save_meta(meta_hash)
> +          end
> +        end
> 
>         def blob_data(credentials, bucket_id, blob_id, opts={})
>           s3_client = new_client(credentials, :s3)
> -- 
> 1.7.3.4
> 

Reply via email to