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

View file

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

View file

@ -8,7 +8,7 @@ module Fog
requires :rackspace_api_key, :rackspace_username requires :rackspace_api_key, :rackspace_username
recognizes :rackspace_auth_url, :rackspace_servicenet, :rackspace_cdn_ssl, :persistent, :rackspace_region 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_path 'fog/rackspace/models/storage'
model :directory model :directory
@ -39,7 +39,7 @@ module Fog
:provider => 'Rackspace', :provider => 'Rackspace',
:rackspace_api_key => @rackspace_api_key, :rackspace_api_key => @rackspace_api_key,
:rackspace_auth_url => @rackspace_auth_url, :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_username => @rackspace_username,
:rackspace_region => @rackspace_region :rackspace_region => @rackspace_region
) )
@ -95,6 +95,7 @@ module Fog
@rackspace_servicenet = options[:rackspace_servicenet] @rackspace_servicenet = options[:rackspace_servicenet]
@rackspace_auth_token = options[:rackspace_auth_token] @rackspace_auth_token = options[:rackspace_auth_token]
@rackspace_storage_url = options[:rackspace_storage_url] @rackspace_storage_url = options[:rackspace_storage_url]
@rackspace_cdn_url = options[:rackspace_cdn_url]
@rackspace_region = options[:rackspace_region] || :dfw @rackspace_region = options[:rackspace_region] || :dfw
@rackspace_temp_url_key = options[:rackspace_temp_url_key] @rackspace_temp_url_key = options[:rackspace_temp_url_key]
@rackspace_must_reauthenticate = false @rackspace_must_reauthenticate = false
@ -144,11 +145,7 @@ module Fog
def service_net? def service_net?
@rackspace_servicenet == true @rackspace_servicenet == true
end end
def v1_authentication?
@identity_service.nil?
end
def authenticate def authenticate
if @rackspace_must_reauthenticate || @rackspace_auth_token.nil? 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 tests('reload').succeeds do
pending if Fog.mocking? pending if Fog.mocking?
catalog = Fog::Identity[:rackspace].service_catalog service = Fog::Identity[:rackspace]
catalog.reload 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
end end