You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2011/06/02 12:27:14 UTC

[PATCH core] Fixed client.create_bucket method to use :name instead of :id

From: Michal Fojtik <mf...@redhat.com>


Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 client/bin/deltacloudc              |    2 +-
 client/deltacloud-client.gemspec    |    2 +-
 client/lib/client_bucket_methods.rb |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/client/bin/deltacloudc b/client/bin/deltacloudc
index f8ecdd0..41f2108 100755
--- a/client/bin/deltacloudc
+++ b/client/bin/deltacloudc
@@ -217,7 +217,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(:name=>options[:name])
         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/deltacloud-client.gemspec b/client/deltacloud-client.gemspec
index ca81d60..81b36d1 100644
--- a/client/deltacloud-client.gemspec
+++ b/client/deltacloud-client.gemspec
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
   s.email = 'deltacloud-users@lists.fedorahosted.org'
   s.name = 'deltacloud-client'
   s.description = %q{Deltacloud REST Client for API}
-  s.version = '0.3.0'
+  s.version = '0.3.1'
   s.summary = %q{Deltacloud REST Client}
   s.files = Dir['Rakefile', 'lib/**/*.rb', 'init.rb', 'bin/deltacloudc']
   s.bindir = 'bin'
diff --git a/client/lib/client_bucket_methods.rb b/client/lib/client_bucket_methods.rb
index cc7dcff..1f71f52 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[:name] }) do |response|
       handle_backend_error(response) if response.code!=201
       obj = base_object(:bucket, response)
     end
@@ -51,4 +51,4 @@ module ClientBucketMethods
     end
   end
 
-end
\ No newline at end of file
+end
-- 
1.7.4.1


Re: [PATCH core] Fixed client.create_bucket method to use :name instead of :id

Posted by "marios@redhat.com" <ma...@redhat.com>.
nack - needs fixing before push:

On 02/06/11 13:27, mfojtik@redhat.com wrote:
> From: Michal Fojtik<mf...@redhat.com>
>
>
> Signed-off-by: Michal fojtik<mf...@redhat.com>
> ---
>   client/bin/deltacloudc              |    2 +-
>   client/deltacloud-client.gemspec    |    2 +-
>   client/lib/client_bucket_methods.rb |    4 ++--
>   3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/client/bin/deltacloudc b/client/bin/deltacloudc
> index f8ecdd0..41f2108 100755
> --- a/client/bin/deltacloudc
> +++ b/client/bin/deltacloudc
> @@ -217,7 +217,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(:name=>options[:name])

must be a typo since options[:name] is null at this point - I think you 
meant:

bucket = client.create_bucket(:name=>options[:id])

Also, since we are changing this for create op, for the sake of 
consistency shouldn't we also change it for destroy op (so that destroy 
becomes client.destroy_bucket(:name=>'the_bucket_name')  - 
lib/client_bucket_methods.rb:13 and bin/deltacloudc:224.

Thanks for doing this though I must say I'm still not entirely clear 
what problem this fixes (I missed part of the conversation on irc 
yesterday - I know its something that the aeolus guys needed?)

thanks, marios

>           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/deltacloud-client.gemspec b/client/deltacloud-client.gemspec
> index ca81d60..81b36d1 100644
> --- a/client/deltacloud-client.gemspec
> +++ b/client/deltacloud-client.gemspec
> @@ -23,7 +23,7 @@ Gem::Specification.new do |s|
>     s.email = 'deltacloud-users@lists.fedorahosted.org'
>     s.name = 'deltacloud-client'
>     s.description = %q{Deltacloud REST Client for API}
> -  s.version = '0.3.0'
> +  s.version = '0.3.1'
>     s.summary = %q{Deltacloud REST Client}
>     s.files = Dir['Rakefile', 'lib/**/*.rb', 'init.rb', 'bin/deltacloudc']
>     s.bindir = 'bin'
> diff --git a/client/lib/client_bucket_methods.rb b/client/lib/client_bucket_methods.rb
> index cc7dcff..1f71f52 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[:name] }) do |response|
>         handle_backend_error(response) if response.code!=201
>         obj = base_object(:bucket, response)
>       end
> @@ -51,4 +51,4 @@ module ClientBucketMethods
>       end
>     end
>
> -end
> \ No newline at end of file
> +end