deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core] EC2: Mount the EC2 frontend on /ec2 instead of /
Date Fri, 31 Aug 2012 08:27:43 GMT
From: Michal Fojtik <mfojtik@redhat.com>

* This will make '/' URI free for use.

Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/config.ru                |    2 +-
 server/lib/ec2/server.rb        |    2 +-
 server/tests/ec2/common.rb      |    4 +---
 server/tests/ec2/server_test.rb |    3 ++-
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/server/config.ru b/server/config.ru
index 0fc58e7..b1ce2a8 100644
--- a/server/config.ru
+++ b/server/config.ru
@@ -39,7 +39,7 @@ Deltacloud::configure(:cimi) do |server|
 end
 
 Deltacloud::configure(:ec2) do |server|
-  server.root_url '/'
+  server.root_url '/ec2'
   server.version '2012-04-01'
   server.klass 'Deltacloud::EC2::API'
   server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
diff --git a/server/lib/ec2/server.rb b/server/lib/ec2/server.rb
index 1e9e23a..15b6000 100644
--- a/server/lib/ec2/server.rb
+++ b/server/lib/ec2/server.rb
@@ -55,7 +55,7 @@ module Deltacloud::EC2
       headers 'Server' => 'Apache-Deltacloud-EC2/' + settings.version
     end
 
-    get '/' do
+    get Deltacloud[:ec2].root_url do
       headers 'Connection' => 'close'
       unless params['Action']
         redirect settings.root_url, 301
diff --git a/server/tests/ec2/common.rb b/server/tests/ec2/common.rb
index fabe5b7..727cd99 100644
--- a/server/tests/ec2/common.rb
+++ b/server/tests/ec2/common.rb
@@ -9,15 +9,13 @@ require_relative '../test_helper.rb'
 #
 
 Deltacloud::configure(:ec2) do |server|
-  server.root_url '/'
+  server.root_url '/ec2'
   server.version '2012-04-01'
   server.klass 'Deltacloud::EC2::API'
   server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
   server.default_driver :mock
 end
 
-Deltacloud.require_frontend! :ec2
-
 Deltacloud[:ec2].require!
 Deltacloud[:ec2].default_frontend!
 
diff --git a/server/tests/ec2/server_test.rb b/server/tests/ec2/server_test.rb
index feca68e..dc07e14 100644
--- a/server/tests/ec2/server_test.rb
+++ b/server/tests/ec2/server_test.rb
@@ -17,7 +17,8 @@ describe Deltacloud::EC2::API do
   it 'must do a redirection when no Action parameter' do
     get root_url
     status.must_equal 301
-    headers['Location'].must_equal 'http://example.org/'
+    headers['Location'].wont_be_empty
+    headers['Location'].must_equal 'http://example.org' + root_url
   end
 
   it 'must set the Connection header to close' do
-- 
1.7.10.2


Mime
View raw message