diff --git a/lib/fog/cdn/rackspace.rb b/lib/fog/cdn/rackspace.rb index 903c0493f..3e3d15d12 100644 --- a/lib/fog/cdn/rackspace.rb +++ b/lib/fog/cdn/rackspace.rb @@ -3,7 +3,7 @@ module Fog class CDN < Fog::Service requires :rackspace_api_key, :rackspace_username - recognizes :rackspace_auth_url, :persistent + recognizes :rackspace_auth_url, :rackspace_servicenet, :persistent recognizes :provider # remove post deprecation model_path 'fog/cdn/models/rackspace' @@ -56,7 +56,7 @@ module Fog @auth_token = credentials['X-Auth-Token'] uri = URI.parse(credentials['X-CDN-Management-Url']) - @host = uri.host + @host = options[:rackspace_servicenet] == true ? "snet-#{uri.host}" : uri.host @path = uri.path @port = uri.port @scheme = uri.scheme diff --git a/lib/fog/compute/rackspace.rb b/lib/fog/compute/rackspace.rb index bdd73f6d3..91407d7b6 100644 --- a/lib/fog/compute/rackspace.rb +++ b/lib/fog/compute/rackspace.rb @@ -3,7 +3,7 @@ module Fog class Compute < Fog::Service requires :rackspace_api_key, :rackspace_username - recognizes :rackspace_auth_url, :persistent + recognizes :rackspace_auth_url, :rackspace_servicenet, :persistent recognizes :provider # remove post deprecation model_path 'fog/compute/models/rackspace' @@ -86,6 +86,7 @@ module Fog @rackspace_api_key = options[:rackspace_api_key] @rackspace_username = options[:rackspace_username] @rackspace_auth_url = options[:rackspace_auth_url] + @rackspace_servicenet = options[:rackspace_servicenet] authenticate @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) end @@ -137,7 +138,7 @@ module Fog credentials = Fog::Rackspace.authenticate(options) @auth_token = credentials['X-Auth-Token'] uri = URI.parse(credentials['X-Server-Management-Url']) - @host = uri.host + @host = @rackspace_servicenet == true ? "snet-#{uri.host}" : uri.host @path = uri.path @port = uri.port @scheme = uri.scheme diff --git a/lib/fog/core/credentials.rb b/lib/fog/core/credentials.rb index 6cf5a15c3..b2003562d 100644 --- a/lib/fog/core/credentials.rb +++ b/lib/fog/core/credentials.rb @@ -84,6 +84,7 @@ An alternate file may be used by placing its path in the FOG_RC environment vari :private_key_path: :rackspace_api_key: :rackspace_username: + :rackspace_servicenet: :slicehost_password: :terremark_username: :terremark_password: diff --git a/lib/fog/storage/rackspace.rb b/lib/fog/storage/rackspace.rb index 8030caa8c..4b3103ea3 100644 --- a/lib/fog/storage/rackspace.rb +++ b/lib/fog/storage/rackspace.rb @@ -3,7 +3,7 @@ module Fog class Storage < Fog::Service requires :rackspace_api_key, :rackspace_username - recognizes :rackspace_auth_url, :persistent + recognizes :rackspace_auth_url, :rackspace_servicenet, :persistent recognizes :provider # remove post deprecation model_path 'fog/storage/models/rackspace' @@ -85,7 +85,7 @@ module Fog @auth_token = credentials['X-Auth-Token'] uri = URI.parse(credentials['X-Storage-Url']) - @host = uri.host + @host = options[:rackspace_servicenet] == true ? "snet-#{uri.host}" : uri.host @path = uri.path @port = uri.port @scheme = uri.scheme diff --git a/tests/helpers/mock_helper.rb b/tests/helpers/mock_helper.rb index dacf6a8b8..50b652ca5 100644 --- a/tests/helpers/mock_helper.rb +++ b/tests/helpers/mock_helper.rb @@ -27,6 +27,7 @@ if Fog.mock? # :private_key_path => '~/.ssh/id_rsa', :rackspace_api_key => 'rackspace_api_key', :rackspace_username => 'rackspace_username', + :rackspace_servicenet => 'rackspace_servicenet', :slicehost_password => 'slicehost_password', :voxel_api_key => 'voxel_api_key', :voxel_api_secret => 'voxel_api_secret',