mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[rackspace] updated to use v1 authentication if rackspace_auth_url endpoint is specified without version as with the current implementation of knife-rackspace
This commit is contained in:
parent
bc51b212e1
commit
d43448e7b7
4 changed files with 18 additions and 8 deletions
|
@ -5,10 +5,11 @@ module Fog
|
|||
private
|
||||
|
||||
def authentication_method
|
||||
if @rackspace_auth_url && @rackspace_auth_url =~ /v1(\.\d)?\w*$/
|
||||
:authenticate_v1
|
||||
return :authenticate_v2 unless @rackspace_auth_url
|
||||
if @rackspace_auth_url =~ /v2(\.\d)?\w*$/
|
||||
:authenticate_v2
|
||||
else
|
||||
:authenticate_v2
|
||||
:authenticate_v1
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,13 +6,16 @@ Shindo.tests('Fog::CDN::Rackspace', ['rackspace']) do
|
|||
end
|
||||
|
||||
tests('#authentication_method') do
|
||||
@service = Fog::CDN::Rackspace.new
|
||||
@service = Fog::Storage::Rackspace.new
|
||||
|
||||
assert_method nil, :authenticate_v2
|
||||
|
||||
|
||||
assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1
|
||||
assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1
|
||||
assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1
|
||||
assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2
|
||||
|
||||
assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1
|
||||
assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1
|
||||
assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1
|
||||
assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2
|
||||
|
|
|
@ -6,13 +6,16 @@ Shindo.tests('Fog::Compute::RackspaceV2', ['rackspace']) do
|
|||
end
|
||||
|
||||
tests('#authentication_method') do
|
||||
@service = Fog::Compute::RackspaceV2.new
|
||||
@service = Fog::Storage::Rackspace.new
|
||||
|
||||
assert_method nil, :authenticate_v2
|
||||
|
||||
|
||||
assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1
|
||||
assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1
|
||||
assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1
|
||||
assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2
|
||||
|
||||
assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1
|
||||
assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1
|
||||
assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1
|
||||
assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2
|
||||
|
|
|
@ -7,12 +7,15 @@ Shindo.tests('Rackspace | Storage', ['rackspace']) do
|
|||
|
||||
tests('#authentication_method') do
|
||||
@service = Fog::Storage::Rackspace.new
|
||||
|
||||
assert_method nil, :authenticate_v2
|
||||
|
||||
|
||||
assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1
|
||||
assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1
|
||||
assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1
|
||||
assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2
|
||||
|
||||
assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1
|
||||
assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1
|
||||
assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1
|
||||
assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2
|
||||
|
|
Loading…
Reference in a new issue