mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[rackspace|compute_v2] fixed chef issue
This commit is contained in:
parent
a3fb609379
commit
f82b25c986
4 changed files with 23 additions and 24 deletions
|
@ -170,30 +170,30 @@ module Fog
|
|||
private
|
||||
|
||||
def setup_custom_endpoint(options)
|
||||
endpoint = options[:rackspace_compute_url] || options[:rackspace_endpoint]
|
||||
@rackspace_endpoint = options[:rackspace_compute_url] || options[:rackspace_endpoint]
|
||||
|
||||
case endpoint
|
||||
when DFW_ENDPOINT
|
||||
@rackspace_region = :dfw
|
||||
@rackspace_endpoint = nil
|
||||
when ORD_ENDPOINT
|
||||
@rackspace_region = :ord
|
||||
@rackspace_endpoint = nil
|
||||
when LON_ENDPOINT
|
||||
@rackspace_region = :lon
|
||||
@rackspace_endpoint = nil
|
||||
else
|
||||
# we are actually using a custom endpoint
|
||||
@rackspace_endpoint = endpoint
|
||||
@rackspace_region = options[:rackspace_region] || :dfw
|
||||
if v2_authentication?
|
||||
case @rackspace_endpoint
|
||||
when DFW_ENDPOINT
|
||||
@rackspace_endpoint = nil
|
||||
@rackspace_region = :dfw
|
||||
when ORD_ENDPOINT
|
||||
@rackspace_endpoint = nil
|
||||
@rackspace_region = :ord
|
||||
when LON_ENDPOINT
|
||||
@rackspace_endpoint = nil
|
||||
@rackspace_region = :lon
|
||||
else
|
||||
# we are actually using a custom endpoint
|
||||
@rackspace_region = options[:rackspace_region] || :dfw
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def deprecation_warnings(options)
|
||||
Fog::Logger.deprecation("The :rackspace_endpoint option is deprecated. Please use :rackspace_compute_url for custom endpoints") if options[:rackspace_endpoint]
|
||||
|
||||
endpoint = options[:rackspace_compute_url] || options[:rackspace_endpoint]
|
||||
if [DFW_ENDPOINT, ORD_ENDPOINT, LON_ENDPOINT].include?(endpoint) && v2_authentication?
|
||||
if [DFW_ENDPOINT, ORD_ENDPOINT, LON_ENDPOINT].include?(@rackspace_endpoint) && v2_authentication?
|
||||
regions = @identity_service.service_catalog.display_service_regions(service_name)
|
||||
Fog::Logger.deprecation("Please specify region using :rackspace_region rather than :rackspace_endpoint. Valid regions for :rackspace_region are #{regions}.")
|
||||
end
|
||||
|
|
|
@ -33,22 +33,21 @@ module Fog
|
|||
private
|
||||
|
||||
def authentication_method
|
||||
return :authenticate_v2 unless @rackspace_auth_url
|
||||
if @rackspace_auth_url =~ /v2(\.\d)?\w*$/
|
||||
if v2_authentication?
|
||||
:authenticate_v2
|
||||
else
|
||||
Fog::Logger.deprecation "Authentication using a v1.0/v1.1 endpoint is deprecated. Please specify a v2.0 endpoint using :rackpace_auth_url.\
|
||||
For a list of v2.0 endpoints refer to http://docs.rackspace.com/auth/api/v2.0/auth-client-devguide/content/Endpoints-d1e180.html"
|
||||
:authenticate_v1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def v1_authentication?
|
||||
@identity_service.nil?
|
||||
!v2_authentication?
|
||||
end
|
||||
|
||||
def v2_authentication?
|
||||
@identity_service != nil
|
||||
@rackspace_auth_url.nil? || @rackspace_auth_url =~ /v2(\.\d)?\w*$/
|
||||
end
|
||||
|
||||
def authenticate_v2(identity_options)
|
||||
|
|
|
@ -6,7 +6,7 @@ Shindo.tests('Fog::CDN::Rackspace', ['rackspace']) do
|
|||
end
|
||||
|
||||
tests('#authentication_method') do
|
||||
@service = Fog::Storage::Rackspace.new
|
||||
@service = Fog::CDN::Rackspace.new
|
||||
|
||||
assert_method nil, :authenticate_v2
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ Shindo.tests('Fog::Compute::RackspaceV2', ['rackspace']) do
|
|||
end
|
||||
|
||||
tests('#authentication_method') do
|
||||
@service = Fog::Storage::Rackspace.new
|
||||
@service = Fog::Compute::RackspaceV2.new
|
||||
|
||||
assert_method nil, :authenticate_v2
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue