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

[rackspace] fixing auth 20 issue where tenant id is not being appended to the service url

This commit is contained in:
Kyle Rames 2013-03-18 10:37:05 -05:00
parent 9f7bf8bddb
commit 81a414a16c
3 changed files with 7 additions and 4 deletions

View file

@ -87,7 +87,7 @@ module Fog
@rackspace_username = options[:rackspace_username]
@rackspace_auth_url = options[:rackspace_auth_url]
@connection_options = options[:connection_options] || {}
@rackspace_endpoint = options[:rackspace_dns_url] || options[:rackspace_dns_endpoint] || US_ENDPOINT
@rackspace_endpoint = options[:rackspace_dns_url] || options[:rackspace_dns_endpoint]
@rackspace_region = options[:rackspace_region]
authenticate
@ -147,7 +147,7 @@ module Fog
def setup_endpoint(credentials)
account_id = credentials['X-Server-Management-Url'].match(/.*\/([\d]+)$/)[1]
@uri = URI.parse(@rackspace_endpoint)
@uri = URI.parse(@rackspace_endpoint || US_ENDPOINT)
@uri.path = "#{@uri.path}/#{account_id}"
end

View file

@ -29,6 +29,7 @@ Shindo.tests('Fog::DNS::Rackspace', ['rackspace']) do
tests('variables populated').succeeds do
@service = Fog::DNS::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0'
returns(true, "auth token populated") { !@service.send(:auth_token).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, "path populated") { @service.instance_variable_get("@uri").path.nil? }
returns(true, "identity_service was not used") { @service.instance_variable_get("@identity_service").nil? }
@service.list_domains
@ -49,6 +50,7 @@ Shindo.tests('Fog::DNS::Rackspace', ['rackspace']) do
@service = Fog::DNS::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0'
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? }
@service.list_domains
end
@ -67,6 +69,7 @@ Shindo.tests('Fog::DNS::Rackspace', ['rackspace']) do
@service = Fog::DNS::Rackspace.new
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
@service.list_domains
end
tests('custom endpoint') do

View file

@ -16,8 +16,8 @@ Shindo.tests('Fog::Compute::RackspaceV2 | metadata_tests', ['rackspace']) do
@server_id = @server.id
@image_id = @server.create_image(name, :metadata => metadata)
@image = @service.images.get @image_id
@image = @server.create_image(name, :metadata => metadata)
@image_id = @image.id
else
@image_id = 1
@server_id = 1