On Oct 27, 2011, at 2:36 PM, Tong Li wrote: > ACK.
Thanks, pushed to to SVN (r1189732) -- Michal > > Tong Li > Emerging Technologies & Standards > B062/K317 > liton...@us.ibm.com > > mfoj...@redhat.com wrote on 10/27/2011 07:17:21 AM: > >> From: mfoj...@redhat.com >> To: deltacloud-dev@incubator.apache.org >> Date: 10/27/2011 07:17 AM >> Subject: [PATCH core 1/8] CIMI: Replaced global! with global_collection >> >> From: Michal Fojtik <mfoj...@redhat.com> >> >> >> Signed-off-by: Michal fojtik <mfoj...@redhat.com> >> --- >> server/lib/cimi/server.rb | 33 +++++++++++++-------------------- >> server/lib/sinatra/rabbit.rb | 6 ++++++ >> 2 files changed, 19 insertions(+), 20 deletions(-) >> >> diff --git a/server/lib/cimi/server.rb b/server/lib/cimi/server.rb >> index 17285bd..a76fe61 100644 >> --- a/server/lib/cimi/server.rb >> +++ b/server/lib/cimi/server.rb >> @@ -23,9 +23,6 @@ include Deltacloud::Drivers >> set :drivers, Proc.new { driver_config } >> >> STOREROOT = File.join($top_srcdir, 'lib', 'cimi', 'data') >> -#We would like to know the storage root. >> -puts "store root is " + STOREROOT >> - >> Sinatra::Application.register Rack::RespondTo >> >> use Rack::ETag >> @@ -70,19 +67,16 @@ error do >> report_error >> end >> >> -get "#{settings.root_url}\/?" do >> - if params[:force_auth] >> - return [401, 'Authentication failed'] unless >> driver.valid_credentials?(credentials) >> - end >> +get "/" do >> + redirect settings.root_url >> +end >> >> +get "#{settings.root_url}\/?" do >> + halt 401 if params[:force_auth] and not driver.valid_credentials? >> (credentials) >> redirect "#{settings.root_url}/cloudEntryPoint", 301 >> end >> >> -collection :cloudEntryPoint do >> - # Make sure this collection can be accessed, regardless of whether the >> - # driver supports it or not >> - global! >> - >> +global_collection :cloudEntryPoint do >> description <<EOS >> cloud entry point >> EOS >> @@ -96,8 +90,8 @@ EOS >> end >> end >> >> -collection :machine_configurations do >> - global! >> +global_collection :machine_configurations do >> + >> >> description <<EOS >> List all machine configurations >> @@ -142,8 +136,8 @@ EOS >> end >> end >> >> -collection :machine_images do >> - global! >> +global_collection :machine_images do >> + >> >> description <<EOS >> List all machine images >> @@ -190,8 +184,8 @@ EOS >> >> end >> >> -collection :machines do >> - global! >> +global_collection :machines do >> + >> >> description <<EOS >> List all machine >> @@ -238,8 +232,7 @@ EOS >> >> end >> >> -collection :volumes do >> - global! >> +global_collection :volumes do >> >> description <<EOS >> List all volumes >> diff --git a/server/lib/sinatra/rabbit.rb b/server/lib/sinatra/rabbit.rb >> index 8f34485..6e8b789 100644 >> --- a/server/lib/sinatra/rabbit.rb >> +++ b/server/lib/sinatra/rabbit.rb >> @@ -393,6 +393,12 @@ module Sinatra >> collections[name].generate >> end >> >> + def global_collection(name, &block) >> + raise DuplicateCollectionException if collections[name] >> + collections[name] = Collection.new(name, { :global => true }, > &block) >> + collections[name].generate >> + end >> + >> # Make sure this collection can be accessed, regardless of whether > the >> # driver supports it or not >> def global_collection(name, &block) >> -- >> 1.7.4.4 ------------------------------------------------------ Michal Fojtik, mfoj...@redhat.com Deltacloud API: http://deltacloud.org