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

[rackspace] updated service_catalog.reload; added rackspace_cdn_url as an option to storage service; tweaked compute_v2 auth

This commit is contained in:
Kyle Rames 2013-02-21 13:07:29 -06:00
parent 505f1c523c
commit 8e3575ea9f
4 changed files with 19 additions and 14 deletions

View file

@ -108,12 +108,12 @@ module Fog
@rackspace_must_reauthenticate = false
@connection_options = options[:connection_options] || {}
@uri = authenticate
authenticate
deprecation_warnings(options)
@persistent = options[:persistent] || false
@connection = Fog::Connection.new(@uri, @persistent, @connection_options)
@connection = Fog::Connection.new(endpoint_uri, @persistent, @connection_options)
end
def deprecation_warnings(options)
@ -133,7 +133,7 @@ module Fog
'X-Auth-Token' => @auth_token
}.merge!(params[:headers] || {}),
:host => @uri.host,
:path => "#{@uri.path}/#{params[:path]}"
:path => "#{endpoint_uri.path}/#{params[:path]}"
}))
rescue Excon::Errors::NotFound => error
raise NotFound.slurp error
@ -176,7 +176,7 @@ 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
}
self.send authentication_method, options
end

View file

@ -42,7 +42,8 @@ module Fog
def reload
@service.authenticate
@service.service_catalog
@catalog = @service.service_catalog.catalog
self
end
def self.from_response(service, hash)

View file

@ -8,7 +8,7 @@ module Fog
requires :rackspace_api_key, :rackspace_username
recognizes :rackspace_auth_url, :rackspace_servicenet, :rackspace_cdn_ssl, :persistent, :rackspace_region
recognizes :rackspace_temp_url_key, :rackspace_storage_url
recognizes :rackspace_temp_url_key, :rackspace_storage_url, :rackspace_cdn_url
model_path 'fog/rackspace/models/storage'
model :directory
@ -39,7 +39,7 @@ module Fog
:provider => 'Rackspace',
:rackspace_api_key => @rackspace_api_key,
:rackspace_auth_url => @rackspace_auth_url,
:rackspace_cdn_url => Fog.credentials[:rackspace_cdn_url],
:rackspace_cdn_url => @rackspace_cdn_url,
:rackspace_username => @rackspace_username,
:rackspace_region => @rackspace_region
)
@ -95,6 +95,7 @@ module Fog
@rackspace_servicenet = options[:rackspace_servicenet]
@rackspace_auth_token = options[:rackspace_auth_token]
@rackspace_storage_url = options[:rackspace_storage_url]
@rackspace_cdn_url = options[:rackspace_cdn_url]
@rackspace_region = options[:rackspace_region] || :dfw
@rackspace_temp_url_key = options[:rackspace_temp_url_key]
@rackspace_must_reauthenticate = false
@ -144,11 +145,7 @@ module Fog
def service_net?
@rackspace_servicenet == true
end
def v1_authentication?
@identity_service.nil?
end
end
def authenticate
if @rackspace_must_reauthenticate || @rackspace_auth_token.nil?

View file

@ -68,7 +68,14 @@ Shindo.tests('Fog::Rackspace::ServiceCatalog | users', ['rackspace']) do
tests('reload').succeeds do
pending if Fog.mocking?
catalog = Fog::Identity[:rackspace].service_catalog
catalog.reload
service = Fog::Identity[:rackspace]
service_catalog = service.service_catalog
service_catalog.catalog[:fakeService] = "http:///fake-endpoint.com"
returns("http:///fake-endpoint.com") { service_catalog.get_endpoint :fakeService }
returns("http:///fake-endpoint.com") { service.service_catalog.get_endpoint :fakeService }
service_catalog.reload
raises(RuntimeError) { service_catalog.get_endpoint :fakeService }
raises(RuntimeError) { service.service_catalog.get_endpoint :fakeService }
end
end