incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1189732 - in /incubator/deltacloud/trunk/server/lib: cimi/server.rb sinatra/rabbit.rb
Date Thu, 27 Oct 2011 13:02:47 GMT
Author: mfojtik
Date: Thu Oct 27 13:02:47 2011
New Revision: 1189732

URL: http://svn.apache.org/viewvc?rev=1189732&view=rev
Log:
CIMI: Replaced global! with global_collection

Modified:
    incubator/deltacloud/trunk/server/lib/cimi/server.rb
    incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb

Modified: incubator/deltacloud/trunk/server/lib/cimi/server.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/cimi/server.rb?rev=1189732&r1=1189731&r2=1189732&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/cimi/server.rb (original)
+++ incubator/deltacloud/trunk/server/lib/cimi/server.rb Thu Oct 27 13:02:47 2011
@@ -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

Modified: incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb?rev=1189732&r1=1189731&r2=1189732&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb (original)
+++ incubator/deltacloud/trunk/server/lib/sinatra/rabbit.rb Thu Oct 27 13:02:47 2011
@@ -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)



Mime
View raw message