On Jul 28, 2011, at 2:34 PM, [email protected] wrote:

ACK.

  -- Michal


> From: marios <[email protected]>
> 
> Addresses bug https://bugzilla.redhat.com/show_bug.cgi?id=725646
> 
> client.create_bucket('id'=>"imagesbucket", 'bucket_location'=>"us-west-1")
> 
> Signed-off-by: marios <[email protected]>
> ---
> client/bin/deltacloudc                          |    3 ++-
> client/lib/client_bucket_methods.rb             |    2 +-
> client/lib/plain_formatter.rb                   |    2 +-
> server/lib/deltacloud/drivers/ec2/ec2_driver.rb |    2 +-
> 4 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/client/bin/deltacloudc b/client/bin/deltacloudc
> index c9b86d1..1d622b7 100755
> --- a/client/bin/deltacloudc
> +++ b/client/bin/deltacloudc
> @@ -61,6 +61,7 @@ BANNER
>   opts.on( '-i', '--id ID', 'ID for operation') { |id| options[:id] = id }
>   opts.on( '-d', '--image-id ID', 'Image ID') { |id| options[:image_id] = id }
>   opts.on( '-b', '--bucket-id ID', 'Bucket ID') {|id| options[:bucket_id] = 
> id }
> +  opts.on( '-r', '--bucket-location NAME', 'Bucket location') {|name| 
> options[:bucket_location] = name }
>   opts.on( '-a', '--arch ARCH', 'Architecture (x86, x86_64)') { |id| 
> options[:architecture] = id }
>   opts.on( '-p', '--hardware-profile HARDWARE_PROFILE', 'Hardware Profile') { 
> |id| options[:hwp_id] = id }
>   opts.on( '-n', '--name NAME', 'Name (for instance eg.)') { |name| 
> options[:name] = name }
> @@ -217,7 +218,7 @@ if options[:collection] and options[:operation]
>   if options[:collection].eql?('buckets')
>     if options[:operation].eql?('create')
>         invalid_usage("Please specify an id for the new bucket with -i") 
> unless options[:id]
> -        bucket = client.create_bucket('id'=>options[:id])
> +        bucket = client.create_bucket('id'=>options[:id], 
> 'bucket_location'=>options[:bucket_location])
>         puts format(bucket)
>     elsif options[:operation].eql?('destroy')
>         invalid_usage("Please specify the bucket you wish to destroy with 
> -i") unless options[:id]
> diff --git a/client/lib/client_bucket_methods.rb 
> b/client/lib/client_bucket_methods.rb
> index edca0a7..346ed35 100644
> --- a/client/lib/client_bucket_methods.rb
> +++ b/client/lib/client_bucket_methods.rb
> @@ -2,7 +2,7 @@ module ClientBucketMethods
> 
>   def create_bucket(params)
>     obj = nil
> -    request(:post, "#{api_uri.to_s}/buckets", {:name => params['id'] }) do 
> |response|
> +    request(:post, "#{api_uri.to_s}/buckets", {:name => 
> params['id'],:location=>params['bucket_location'] }) do |response|
>       handle_backend_error(response) if response.code!=201
>       obj = base_object(:bucket, response)
>     end
> diff --git a/client/lib/plain_formatter.rb b/client/lib/plain_formatter.rb
> index 9f95e0f..c12ec15 100644
> --- a/client/lib/plain_formatter.rb
> +++ b/client/lib/plain_formatter.rb
> @@ -100,7 +100,7 @@ module DeltaCloud
>           @obj.id,
>           @obj.name,
>           @obj.size ? @obj.size : "0",
> -          @obj.blob_list ? @obj.blob_list : ""
> +          @obj.instance_variables.include?("@blob_list") ? @obj.blob_list : 
> ""
>           )
>         end
>       end
> diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb 
> b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> index 67a4de4..5fc4f49 100644
> --- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> +++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> @@ -351,7 +351,7 @@ module Deltacloud
>           safely do
>             s3_client = new_client(credentials, :s3)
>             bucket_location = opts['location']
> -            if bucket_location
> +            if (bucket_location && bucket_location.size >0)
>               bucket = Aws::S3::Bucket.create(s3_client, name, true, nil, 
> :location => bucket_location)
>             else
>               bucket = Aws::S3::Bucket.create(s3_client, name, true)
> -- 
> 1.7.3.4
> 

Reply via email to