1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #1849 from rackspace/proxy

[Rackspace] add proxy support for Auth 2.0
This commit is contained in:
Kyle Rames 2013-06-04 08:19:37 -07:00
commit 5eebf7d760
17 changed files with 63 additions and 25 deletions

View file

@ -117,7 +117,8 @@ module Fog
options = {
:rackspace_api_key => @rackspace_api_key,
:rackspace_username => @rackspace_username,
:rackspace_auth_url => @rackspace_auth_url
:rackspace_auth_url => @rackspace_auth_url,
:connection_options => @connection_options
}
super(options)
end

View file

@ -244,7 +244,8 @@ module Fog
options = {
:rackspace_api_key => @rackspace_api_key,
:rackspace_username => @rackspace_username,
:rackspace_auth_url => @rackspace_auth_url
:rackspace_auth_url => @rackspace_auth_url,
:connection_options => @connection_options
}
super(options)
else

View file

@ -174,7 +174,8 @@ module Fog
options = {
:rackspace_api_key => @rackspace_api_key,
:rackspace_username => @rackspace_username,
:rackspace_auth_url => @rackspace_auth_url
:rackspace_auth_url => @rackspace_auth_url,
:connection_options => @connection_options
}
super(options)
end

View file

@ -119,7 +119,8 @@ module Fog
options = {
:rackspace_api_key => @rackspace_api_key,
:rackspace_username => @rackspace_username,
:rackspace_auth_url => @rackspace_auth_url
:rackspace_auth_url => @rackspace_auth_url,
:connection_options => @connection_options
}
super(options)

View file

@ -162,7 +162,8 @@ module Fog
options = {
:rackspace_api_key => @rackspace_api_key,
:rackspace_username => @rackspace_username,
:rackspace_auth_url => @rackspace_auth_url
:rackspace_auth_url => @rackspace_auth_url,
:connection_options => @connection_options
}
super(options)

View file

@ -150,7 +150,8 @@ module Fog
options = {
:rackspace_api_key => @rackspace_api_key,
:rackspace_username => @rackspace_username,
:rackspace_auth_url => @rackspace_auth_url
:rackspace_auth_url => @rackspace_auth_url,
:connection_options => @connection_options
}
super(options)
end

View file

@ -54,7 +54,8 @@ module Fog
hash = {
:rackspace_api_key => identity_options[:rackspace_api_key],
:rackspace_username => identity_options[:rackspace_username],
:rackspace_auth_url => identity_options[:rackspace_auth_url]
:rackspace_auth_url => identity_options[:rackspace_auth_url],
:connection_options => identity_options[:connection_options] || {}
}
@identity_service = Fog::Rackspace::Identity.new(hash)

View file

@ -181,7 +181,8 @@ module Fog
options = {
:rackspace_api_key => @rackspace_api_key,
:rackspace_username => @rackspace_username,
:rackspace_auth_url => @rackspace_auth_url
:rackspace_auth_url => @rackspace_auth_url,
:connection_options => @connection_options
}
super(options)
else

View file

@ -42,14 +42,17 @@ Shindo.tests('Fog::Rackspace::BlockStorage', ['rackspace']) do
end
end
tests('current authentation') do
tests('current authentication') do
pending if Fog.mocking?
tests('variables populated').succeeds do
@service = Fog::Rackspace::BlockStorage.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0'
@service = Fog::Rackspace::BlockStorage.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => {:ssl_verify_peer => true}
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? }
returns(false, "identity service was used") { @service.instance_variable_get("@identity_service").nil? }
identity_service = @service.instance_variable_get("@identity_service")
returns(false, "identity service was used") { identity_service.nil? }
returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) }
@service.list_volumes
end
tests('dfw region').succeeds do

View file

@ -43,10 +43,13 @@ Shindo.tests('Fog::CDN::Rackspace', ['rackspace']) do
pending if Fog.mocking?
tests('variables populated').succeeds do
@service = Fog::CDN::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0'
@service = Fog::CDN::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => { :ssl_verify_peer => true }
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
returns(false, "path populated") { @service.instance_variable_get("@uri").path.nil? }
returns(false, "identity service was used") { @service.instance_variable_get("@identity_service").nil? }
identity_service = @service.instance_variable_get("@identity_service")
returns(false, "identity service was used") { identity_service.nil? }
returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) }
@service.get_containers
end
tests('dfw region').succeeds do

View file

@ -43,11 +43,13 @@ Shindo.tests('Rackspace | Compute', ['rackspace']) do
pending if Fog.mocking?
tests('variables populated').succeeds do
@service = Fog::Compute::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0'
@service = Fog::Compute::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => { :ssl_verify_peer => true }
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
returns(true) { (@service.instance_variable_get("@uri").host == 'servers.api.rackspacecloud.com') != nil }
returns(false, "identity service was used") { @service.instance_variable_get("@identity_service").nil? }
identity_service = @service.instance_variable_get("@identity_service")
returns(false, "identity service was used") { identity_service.nil? }
returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) }
@service.list_flavors
end

View file

@ -46,10 +46,12 @@ Shindo.tests('Fog::Compute::RackspaceV2', ['rackspace']) do
pending if Fog.mocking?
tests('variables populated').succeeds do
@service = Fog::Compute::RackspaceV2.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0'
@service = Fog::Compute::RackspaceV2.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => {:ssl_verify_peer => true}
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? }
returns(false, "identity service was used") { @service.instance_variable_get("@identity_service").nil? }
identity_service = @service.instance_variable_get("@identity_service")
returns(false, "identity service was used") { identity_service.nil? }
returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) }
@service.list_flavors
end
tests('dfw region').succeeds do

View file

@ -46,10 +46,13 @@ Shindo.tests('Fog::Rackspace::Databases', ['rackspace']) do |variable|
pending if Fog.mocking?
tests('variables populated').succeeds do
@service = Fog::Rackspace::Databases.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0'
@service = Fog::Rackspace::Databases.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => { :ssl_verify_peer => true }
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
returns(false, "path populated") { @service.instance_variable_get("@uri").nil? }
returns(false, "identity service was used") { @service.instance_variable_get("@identity_service").nil? }
identity_service = @service.instance_variable_get("@identity_service")
returns(false, "identity service was used") { identity_service.nil? }
returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) }
@service.flavors
end
tests('dfw region').succeeds do

View file

@ -47,11 +47,14 @@ Shindo.tests('Fog::DNS::Rackspace', ['rackspace']) do
pending if Fog.mocking?
tests('variables populated').succeeds do
@service = Fog::DNS::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0'
@service = Fog::DNS::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => { :ssl_verify_peer => true }
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? }
returns(true, "contains tenant id") { (@service.instance_variable_get("@uri").path =~ /\/v1\.0\/\d+$/) != nil} #dns does not error if tenant id is missing
returns(false, "identity service was used") { @service.instance_variable_get("@identity_service").nil? }
identity_service = @service.instance_variable_get("@identity_service")
returns(false, "identity service was used") { identity_service.nil? }
returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) }
@service.list_domains
end
tests('custom endpoint') do

View file

@ -46,10 +46,12 @@ Shindo.tests('Fog::Rackspace::LoadBalancers', ['rackspace']) do
pending if Fog.mocking?
tests('variables populated').succeeds do
@service = Fog::Rackspace::LoadBalancers.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0'
@service = Fog::Rackspace::LoadBalancers.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => { :ssl_verify_peer => true }
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
returns(false, "path populated") { @service.instance_variable_get("@uri").host.nil? }
returns(false, "identity service was used") { @service.instance_variable_get("@identity_service").nil? }
identity_service = @service.instance_variable_get("@identity_service")
returns(false, "identity service was used") { identity_service.nil? }
returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) }
@service.list_load_balancers
end
tests('dfw region').succeeds do

View file

@ -53,6 +53,15 @@ Shindo.tests('Fog::Rackspace::Identity | tokens', ['rackspace']) do
tests('#create_token').formats(ACCESS_FORMAT) do
service.create_token(username, api_key).body
end
tests('uses connection options').returns(true) do
identity_service = Fog::Rackspace::Identity.new(:connection_options => { :ssl_verify_peer => true })
connection = identity_service.instance_variable_get("@connection")
excon = connection.instance_variable_get("@excon")
data = excon.instance_variable_get("@data")
data.has_key?(:ssl_verify_peer)
end
end
tests('failure') do

View file

@ -43,10 +43,13 @@ Shindo.tests('Rackspace | Storage', ['rackspace']) do
pending if Fog.mocking?
tests('variables populated').succeeds do
@service = Fog::Storage::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0'
@service = Fog::Storage::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => { :ssl_verify_peer => true }
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
returns(false, "path populated") { @service.instance_variable_get("@uri").nil? }
returns(false, "identity service was used") { @service.instance_variable_get("@identity_service").nil? }
identity_service = @service.instance_variable_get("@identity_service")
returns(false, "identity service was used") { identity_service.nil? }
returns(true, "connection_options are passed") { identity_service.instance_variable_get("@connection_options").has_key?(:ssl_verify_peer) }
@service.head_containers
end
tests('dfw region').succeeds do