incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 2/2] Added an option to switch driver using matrix params
Date Mon, 07 Mar 2011 12:48:08 GMT
From: Michal Fojtik <mfojtik@redhat.com>

---
 server/lib/sinatra/rack_driver_select.rb |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/server/lib/sinatra/rack_driver_select.rb b/server/lib/sinatra/rack_driver_select.rb
index 4acaf27..67d30e6 100644
--- a/server/lib/sinatra/rack_driver_select.rb
+++ b/server/lib/sinatra/rack_driver_select.rb
@@ -31,11 +31,19 @@ module Rack
 
     def call(env)
       original_settings = { }
+      req = Rack::Request.new(env)
+      if req.params['api'] and req.params['api']['driver']
+	env['HTTP_X_DELTACLOUD_DRIVER'] = req.params['api']['driver']
+      end
+      if req.params['api'] and req.params['api']['provider']
+	env['HTTP_X_DELTACLOUD_PROVIDER'] = req.params['api']['provider']
+      end
       HEADER_TO_ENV_MAP.each do |header, name|
         original_settings[name] = Thread.current[name]
         new_setting = extract_header(env, header)
         Thread.current[name] = new_setting if new_setting
       end
+
       @app.call(env)
     ensure
       original_settings.each { |name, value| Thread.current[name] = value }
-- 
1.7.4


Mime
View raw message