Hi,

I tried to accomplish the idea, which originally comes from Tobi and was
discussed few days later. 
The idea is, that you should be able to set driver using HTTP header for
single request.
So I implemented a simple Rack middleware, which is checking for 
X-Deltacloud-Driver header. But instead of modifying ENV variable I used 
Sinatra 'set' helper (which is fixed and working in Sinatra 1.1.0). 

So testing of this patchset is simple:

$ ./bin/deltacloudd -i mock
$ restclient

RestClient.get "http://localhost:3001/api";, :headers => [ 
"X-Deltacloud-Driver:ec2" ]}
=> "<api driver='ec2' version='0.0.1'>........

RestClient.get "http://localhost:3001/api";, :headers => [ 
"X-Deltacloud-Driver:gogrid" ]}
=> "<api driver='gogrid' version='0.0.1'>........

RestClient.get "http://localhost:3001/api";
=> "<api driver='mock' version='0.0.1'>........


Let me know what do you think and feel free to modify/add something into this
path. One issue which I have in my mind is if this settings stuff is 'thread'
safe, eg. if two parallel requests will not change driver setting at once.

  -- Michal


Reply via email to