mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #2711 from fog/connection_deprecation_warning
[core] Deprecate Fog::Connection
This commit is contained in:
commit
7a152a2dc9
94 changed files with 156 additions and 112 deletions
|
@ -83,7 +83,7 @@ module Fog
|
|||
@hmac = Fog::HMAC.new('sha1', @storage_secret_decoded)
|
||||
@persistent = options.fetch(:persistent, false)
|
||||
|
||||
@connection = Fog::Connection.new("#{@prefix}://#{@storage_host}:#{@storage_port}",
|
||||
@connection = Fog::XML::Connection.new("#{@prefix}://#{@storage_host}:#{@storage_port}",
|
||||
@persistent, @connection_options)
|
||||
end
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ module Fog
|
|||
@port = options[:port] || 443
|
||||
@persistent = options[:persistent] || false
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -78,7 +78,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -154,7 +154,7 @@ EOF
|
|||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@version = options[:version] || '2010-11-01'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -60,7 +60,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -104,7 +104,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -399,7 +399,7 @@ module Fog
|
|||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
end
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -62,7 +62,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
|
||||
setup_credentials(options)
|
||||
end
|
||||
|
|
|
@ -99,7 +99,7 @@ module Fog
|
|||
@scheme = options[:scheme] || 'https'
|
||||
@version = options[:version] || '2012-02-29'
|
||||
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -88,7 +88,7 @@ module Fog
|
|||
@port = options[:port] || '443'
|
||||
@scheme = options[:scheme] || 'https'
|
||||
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -62,7 +62,7 @@ module Fog
|
|||
@path = options[:path] || '/'
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new(
|
||||
@connection = Fog::XML::Connection.new(
|
||||
"#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent]
|
||||
)
|
||||
end
|
||||
|
|
|
@ -139,7 +139,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -73,7 +73,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@region = options[:region]
|
||||
end
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ module Fog
|
|||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -168,7 +168,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@version = options[:version] || '2013-05-15'
|
||||
end
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ module Fog
|
|||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -89,7 +89,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -61,7 +61,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -89,7 +89,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -523,7 +523,7 @@ DATA
|
|||
else
|
||||
@connection = nil
|
||||
end
|
||||
@connection ||= Fog::Connection.new(uri, @persistent, @connection_options)
|
||||
@connection ||= Fog::XML::Connection.new(uri, @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def request(params, &block)
|
||||
|
@ -550,7 +550,7 @@ DATA
|
|||
headers = (error.response.is_a?(Hash) ? error.response[:headers] : error.response.headers)
|
||||
uri = URI.parse(headers['Location'])
|
||||
Fog::Logger.warning("fog: followed redirect to #{uri.host}, connecting to the matching region will be more performant")
|
||||
response = Fog::Connection.new("#{uri.scheme}://#{uri.host}:#{uri.port}", false, @connection_options).request(original_params, &block)
|
||||
response = Fog::XML::Connection.new("#{uri.scheme}://#{uri.host}:#{uri.port}", false, @connection_options).request(original_params, &block)
|
||||
end
|
||||
|
||||
response
|
||||
|
|
|
@ -83,7 +83,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -58,7 +58,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -50,7 +50,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:bluebox_port] || 443
|
||||
@scheme = options[:bluebox_scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -68,7 +68,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:bluebox_port] || 443
|
||||
@scheme = options[:bluebox_scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -59,7 +59,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:bluebox_port] || 443
|
||||
@scheme = options[:bluebox_scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -84,7 +84,7 @@ module Fog
|
|||
@clodo_must_reauthenticate = false
|
||||
authenticate
|
||||
Excon.ssl_verify_peer = false if options[:clodo_servicenet] == true
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent])
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent])
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -13,7 +13,7 @@ module Fog
|
|||
url = clodo_auth_url.match(/^https?:/) ? \
|
||||
clodo_auth_url : 'https://' + clodo_auth_url
|
||||
uri = URI.parse(url)
|
||||
connection = Fog::Connection.new(url)
|
||||
connection = Fog::XML::Connection.new(url)
|
||||
@clodo_api_key = options[:clodo_api_key]
|
||||
@clodo_username = options[:clodo_username]
|
||||
response = connection.request({
|
||||
|
|
|
@ -37,7 +37,7 @@ module Fog
|
|||
@api_version = options[:cloudsigma_api_version] || '2.0'
|
||||
@path_prefix = "#{@api_path_prefix}/#{@api_version}/"
|
||||
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def request(params)
|
||||
|
|
|
@ -149,7 +149,7 @@ module Fog
|
|||
@path = options[:cloudstack_path] || '/client/api'
|
||||
@port = options[:cloudstack_port] || 443
|
||||
@scheme = options[:cloudstack_scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:cloudstack_persistent], {:ssl_verify_peer => false})
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:cloudstack_persistent], {:ssl_verify_peer => false})
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -12,13 +12,14 @@ module Fog
|
|||
#
|
||||
# @see https://github.com/geemus/excon/blob/master/lib/excon/connection.rb
|
||||
#
|
||||
class Connection < Fog::XML::SAXParserConnection
|
||||
class Connection < Fog::XML::Connection
|
||||
def request(params, &block)
|
||||
if (parser = params.delete(:parser))
|
||||
super(parser, params)
|
||||
if params.key?(:parser)
|
||||
Fog::Logger.deprecation("Fog::XML::Connection is deprecated use Fog::XML::Connection instead [light_black](#{caller.first})[/]")
|
||||
else
|
||||
original_request(params)
|
||||
Fog::Logger.deprecation("Fog::XML::Connection is deprecated use Fog::Core::Connection instead [light_black](#{caller.first})[/]")
|
||||
end
|
||||
super(params)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -77,7 +77,7 @@ module Fog
|
|||
@digitalocean_client_id = options[:digitalocean_client_id]
|
||||
@digitalocean_api_url = options[:digitalocean_api_url] || \
|
||||
"https://api.digitalocean.com"
|
||||
@connection = Fog::Connection.new(@digitalocean_api_url)
|
||||
@connection = Fog::XML::Connection.new(@digitalocean_api_url)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -70,7 +70,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -87,7 +87,7 @@ module Fog
|
|||
@persistent = options.fetch(:persistent, true)
|
||||
@port = options[:port] || 80 #443 Not yet
|
||||
@scheme = options[:scheme] || 'http' #'https Not yet
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -57,7 +57,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -72,7 +72,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@version = options[:version] || '3.5.2'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def auth_token
|
||||
|
|
|
@ -317,7 +317,7 @@ module Fog
|
|||
|
||||
# Hash connections on the host_url ... There's nothing to say we won't get URI's that go to
|
||||
# different hosts.
|
||||
@connections[host_url] ||= Fog::Connection.new(host_url, @persistent, @connection_options)
|
||||
@connections[host_url] ||= Fog::XML::Connection.new(host_url, @persistent, @connection_options)
|
||||
|
||||
# Set headers to an empty hash if none are set.
|
||||
headers = set_extra_headers_for(params) || set_extra_headers_for({})
|
||||
|
|
|
@ -79,7 +79,7 @@ module Fog
|
|||
@glesys_api_key = options[:glesys_api_key] || Fog.credentials[:glesys_api_key]
|
||||
@connection_options = options[:connection_options] || {}
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new(@api_url, @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new(@api_url, @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def request(method_name, options = {})
|
||||
|
|
|
@ -68,7 +68,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -283,7 +283,7 @@ DATA
|
|||
else
|
||||
@connection = nil
|
||||
end
|
||||
@connection ||= Fog::Connection.new(uri, @persistent, @connection_options)
|
||||
@connection ||= Fog::XML::Connection.new(uri, @persistent, @connection_options)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -138,7 +138,7 @@ module Fog
|
|||
@port = uri.port
|
||||
@scheme = uri.scheme
|
||||
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -127,7 +127,7 @@ module Fog
|
|||
@port = uri.port
|
||||
@scheme = uri.scheme
|
||||
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -115,7 +115,7 @@ module Fog
|
|||
@path = uri.path.chomp("/")
|
||||
@port = uri.port
|
||||
@scheme = uri.scheme
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@enabled = true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -220,7 +220,7 @@ module Fog
|
|||
@port = uri.port
|
||||
@scheme = uri.scheme
|
||||
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -274,7 +274,7 @@ module Fog
|
|||
@port = uri.port
|
||||
@scheme = uri.scheme
|
||||
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -82,7 +82,7 @@ module Fog
|
|||
# Set the User-Agent
|
||||
@user_agent = options[:user_agent]
|
||||
set_user_agent_header(connection_options, "fog/#{Fog::VERSION}", @user_agent)
|
||||
connection = Fog::Connection.new(service_url, false, connection_options)
|
||||
connection = Fog::XML::Connection.new(service_url, false, connection_options)
|
||||
@hp_access_key = options[:hp_access_key]
|
||||
@hp_secret_key = options[:hp_secret_key]
|
||||
response = connection.request({
|
||||
|
@ -158,7 +158,7 @@ module Fog
|
|||
# Set the User-Agent. If the caller sets a user_agent, use it.
|
||||
@user_agent = options[:user_agent]
|
||||
set_user_agent_header(connection_options, "fog/#{Fog::VERSION}", @user_agent)
|
||||
connection = Fog::Connection.new(service_url, false, connection_options)
|
||||
connection = Fog::XML::Connection.new(service_url, false, connection_options)
|
||||
|
||||
### Implement HP Control Services Authentication services ###
|
||||
# Get the style of auth credentials passed, defaults to access/secret key style
|
||||
|
|
|
@ -97,7 +97,7 @@ module Fog
|
|||
@port = uri.port
|
||||
@scheme = uri.scheme
|
||||
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -132,7 +132,7 @@ module Fog
|
|||
@port = uri.port
|
||||
@scheme = uri.scheme
|
||||
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -155,7 +155,7 @@ module Fog
|
|||
@port = uri.port
|
||||
@scheme = uri.scheme
|
||||
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -351,7 +351,7 @@ module Fog
|
|||
@port = uri.port
|
||||
@scheme = uri.scheme
|
||||
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -16,7 +16,7 @@ module Fog
|
|||
1800
|
||||
end
|
||||
|
||||
class Connection < Fog::Connection
|
||||
class Connection < Fog::XML::Connection
|
||||
|
||||
def initialize(user, password)
|
||||
@user = user
|
||||
|
|
|
@ -269,7 +269,7 @@ module Fog
|
|||
@port = options[:port] || 80
|
||||
@scheme = options[:scheme] || 'http'
|
||||
end
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
@ -376,7 +376,7 @@ DATA
|
|||
rescue Excon::Errors::TemporaryRedirect => error
|
||||
uri = URI.parse(error.response.headers['location'])
|
||||
Fog::Logger.warning("fog: followed redirect to #{uri.host}, connecting to the matching region will be more performant")
|
||||
response = Fog::Connection.new("#{@scheme}://#{uri.host}:#{@port}", false, @connection_options).request(original_params, &block)
|
||||
response = Fog::XML::Connection.new("#{@scheme}://#{uri.host}:#{@port}", false, @connection_options).request(original_params, &block)
|
||||
end
|
||||
|
||||
response
|
||||
|
|
|
@ -188,7 +188,7 @@ module Fog
|
|||
raise ArgumentError, "Must provide either a joyent_password or joyent_keyname and joyent_keyfile pair"
|
||||
end
|
||||
|
||||
@connection = Fog::Connection.new(
|
||||
@connection = Fog::XML::Connection.new(
|
||||
@joyent_url,
|
||||
@persistent,
|
||||
@connection_options
|
||||
|
|
|
@ -158,7 +158,7 @@ module Fog
|
|||
raise ArgumentError, "Must provide either a joyent_password or joyent_keyname and joyent_keyfile pair"
|
||||
end
|
||||
|
||||
@connection = Fog::Connection.new(
|
||||
@connection = Fog::XML::Connection.new(
|
||||
@joyent_url,
|
||||
@persistent,
|
||||
@connection_options
|
||||
|
|
|
@ -83,7 +83,7 @@ module Fog
|
|||
@host = options[:host] || "api.linode.com"
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent])
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent])
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -58,7 +58,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -89,7 +89,7 @@ module Fog
|
|||
@ninefold_compute_secret = options[:ninefold_compute_secret] || Fog.credentials[:ninefold_compute_secret]
|
||||
@connection_options = options[:connection_options] || {}
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new(@api_url, @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new(@api_url, @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def request(command, params, options)
|
||||
|
|
|
@ -320,7 +320,7 @@ module Fog
|
|||
authenticate
|
||||
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def credentials
|
||||
|
@ -422,7 +422,7 @@ module Fog
|
|||
|
||||
# Not all implementations have identity service in the catalog
|
||||
if @openstack_identity_public_endpoint || @openstack_management_url
|
||||
@identity_connection = Fog::Connection.new(
|
||||
@identity_connection = Fog::XML::Connection.new(
|
||||
@openstack_identity_public_endpoint || @openstack_management_url,
|
||||
false, @connection_options)
|
||||
end
|
||||
|
|
|
@ -63,7 +63,7 @@ module Fog
|
|||
# legacy v1.0 style auth
|
||||
def self.authenticate_v1(options, connection_options = {})
|
||||
uri = options[:openstack_auth_uri]
|
||||
connection = Fog::Connection.new(uri.to_s, false, connection_options)
|
||||
connection = Fog::XML::Connection.new(uri.to_s, false, connection_options)
|
||||
@openstack_api_key = options[:openstack_api_key]
|
||||
@openstack_username = options[:openstack_username]
|
||||
|
||||
|
@ -102,7 +102,7 @@ module Fog
|
|||
|
||||
unless service
|
||||
unless tenant_name
|
||||
response = Fog::Connection.new(
|
||||
response = Fog::XML::Connection.new(
|
||||
"#{uri.scheme}://#{uri.host}:#{uri.port}/v2.0/tenants", false, connection_options).request({
|
||||
:expects => [200, 204],
|
||||
:headers => {'Content-Type' => 'application/json',
|
||||
|
@ -186,7 +186,7 @@ module Fog
|
|||
auth_token = options[:openstack_auth_token] || options[:unscoped_token]
|
||||
uri = options[:openstack_auth_uri]
|
||||
|
||||
connection = Fog::Connection.new(uri.to_s, false, connection_options)
|
||||
connection = Fog::XML::Connection.new(uri.to_s, false, connection_options)
|
||||
request_body = {:auth => Hash.new}
|
||||
|
||||
if auth_token
|
||||
|
@ -213,7 +213,7 @@ module Fog
|
|||
end
|
||||
|
||||
def self.get_supported_version(supported_versions, uri, auth_token, connection_options = {})
|
||||
connection = Fog::Connection.new("#{uri.scheme}://#{uri.host}:#{uri.port}", false, connection_options)
|
||||
connection = Fog::XML::Connection.new("#{uri.scheme}://#{uri.host}:#{uri.port}", false, connection_options)
|
||||
response = connection.request({
|
||||
:expects => [200, 204, 300],
|
||||
:headers => {'Content-Type' => 'application/json',
|
||||
|
|
|
@ -200,7 +200,7 @@ module Fog
|
|||
authenticate
|
||||
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def credentials
|
||||
|
|
|
@ -122,7 +122,7 @@ module Fog
|
|||
authenticate
|
||||
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def credentials
|
||||
|
|
|
@ -116,7 +116,7 @@ module Fog
|
|||
authenticate
|
||||
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def credentials
|
||||
|
|
|
@ -256,7 +256,7 @@ module Fog
|
|||
authenticate
|
||||
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def credentials
|
||||
|
|
|
@ -114,7 +114,7 @@ module Fog
|
|||
authenticate
|
||||
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def credentials
|
||||
|
@ -214,7 +214,7 @@ module Fog
|
|||
|
||||
# Not all implementations have identity service in the catalog
|
||||
if @openstack_identity_public_endpoint || @openstack_management_url
|
||||
@identity_connection = Fog::Connection.new(
|
||||
@identity_connection = Fog::XML::Connection.new(
|
||||
@openstack_identity_public_endpoint || @openstack_management_url,
|
||||
false, @connection_options)
|
||||
end
|
||||
|
|
|
@ -92,7 +92,7 @@ module Fog
|
|||
@openstack_temp_url_key = options[:openstack_temp_url_key]
|
||||
authenticate
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -136,7 +136,7 @@ module Fog
|
|||
authenticate
|
||||
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def credentials
|
||||
|
|
|
@ -96,7 +96,7 @@ module Fog
|
|||
|
||||
authenticate
|
||||
|
||||
@connection = Fog::Connection.new(endpoint_uri.to_s, @options[:persistent], @options[:connection_options])
|
||||
@connection = Fog::XML::Connection.new(endpoint_uri.to_s, @options[:persistent], @options[:connection_options])
|
||||
end
|
||||
|
||||
def request(params, parse_json = true, &block)
|
||||
|
|
|
@ -82,7 +82,7 @@ module Fog
|
|||
deprecation_warnings(options)
|
||||
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def request(params, parse_json = true)
|
||||
|
|
|
@ -143,7 +143,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
|
||||
if endpoint_uri
|
||||
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
@enabled = true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -197,7 +197,7 @@ module Fog
|
|||
authenticate
|
||||
Excon.defaults[:ssl_verify_peer] = false if service_net?
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -145,7 +145,7 @@ module Fog
|
|||
deprecation_warnings(options)
|
||||
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def request(params, parse_json = true)
|
||||
|
|
|
@ -104,7 +104,7 @@ module Fog
|
|||
url = rackspace_auth_url.match(/^https?:/) ? \
|
||||
rackspace_auth_url : 'https://' + rackspace_auth_url
|
||||
uri = URI.parse(url)
|
||||
connection = Fog::Connection.new(url, false, connection_options)
|
||||
connection = Fog::XML::Connection.new(url, false, connection_options)
|
||||
@rackspace_api_key = options[:rackspace_api_key]
|
||||
@rackspace_username = options[:rackspace_username]
|
||||
response = connection.request({
|
||||
|
|
|
@ -82,7 +82,7 @@ module Fog
|
|||
deprecation_warnings(options)
|
||||
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def request(params, parse_json = true)
|
||||
|
|
|
@ -101,7 +101,7 @@ module Fog
|
|||
deprecation_warnings(options)
|
||||
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def endpoint_uri(service_endpoint_url=nil)
|
||||
|
|
|
@ -74,7 +74,7 @@ module Fog
|
|||
|
||||
def initialize(options={})
|
||||
apply_options(options)
|
||||
@connection = Fog::Connection.new(@uri.to_s, @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new(@uri.to_s, @persistent, @connection_options)
|
||||
|
||||
authenticate
|
||||
end
|
||||
|
|
|
@ -119,7 +119,7 @@ module Fog
|
|||
deprecation_warnings(options)
|
||||
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def request(params, parse_json = true)
|
||||
|
|
|
@ -140,7 +140,7 @@ module Fog
|
|||
authenticate
|
||||
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -378,7 +378,7 @@ module Fog
|
|||
authenticate
|
||||
|
||||
@persistent = options[:persistent] || false
|
||||
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def request(params, parse_json = true, &block)
|
||||
|
|
|
@ -419,7 +419,7 @@ module Fog
|
|||
authenticate
|
||||
@persistent = options[:persistent] || false
|
||||
Excon.defaults[:ssl_verify_peer] = false if service_net?
|
||||
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
|
||||
end
|
||||
|
||||
# Using SSL?
|
||||
|
|
|
@ -48,7 +48,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 443
|
||||
@scheme = options[:scheme] || 'https'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -53,7 +53,7 @@ module Fog
|
|||
@connection_options = options[:connection_options] || {}
|
||||
@persistent = options[:persistent] || false
|
||||
|
||||
@raw_connection = Fog::Connection.new(riakcs_uri, @persistent, @connection_options)
|
||||
@raw_connection = Fog::XML::Connection.new(riakcs_uri, @persistent, @connection_options)
|
||||
|
||||
@s3_connection = Fog::Storage.new(
|
||||
:provider => 'AWS',
|
||||
|
|
|
@ -59,7 +59,7 @@ module Fog
|
|||
@api_key = options[:serverlove_api_key] || Fog.credentials[:serverlove_api_key]
|
||||
@api_host = options[:serverlove_api_url] || Fog.credentials[:serverlove_api_url] || API_HOST
|
||||
|
||||
@connection = Fog::Connection.new("https://#{@api_uuid}:#{@api_key}@#{@api_host}")
|
||||
@connection = Fog::XML::Connection.new("https://#{@api_uuid}:#{@api_key}@#{@api_host}")
|
||||
end
|
||||
|
||||
def request(params)
|
||||
|
|
|
@ -15,7 +15,7 @@ module Fog
|
|||
@scheme = uri.scheme
|
||||
@storm_on_demand_username = options[:storm_on_demand_username]
|
||||
@storm_on_demand_password = options[:storm_on_demand_password]
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
|
@ -46,7 +46,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || Fog::Terremark::Vcloud::Defaults::PORT
|
||||
@scheme = options[:scheme] || Fog::Terremark::Vcloud::Defaults::SCHEME
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def default_vdc_id
|
||||
|
|
|
@ -319,7 +319,7 @@ module Fog
|
|||
|
||||
# Hash connections on the host_url ... There's nothing to say we won't get URI's that go to
|
||||
# different hosts.
|
||||
@connections[host_url] ||= Fog::Connection.new(host_url, @persistent, @connection_options)
|
||||
@connections[host_url] ||= Fog::XML::Connection.new(host_url, @persistent, @connection_options)
|
||||
|
||||
# Set headers to an empty hash if none are set.
|
||||
headers = params[:headers] || {}
|
||||
|
|
|
@ -335,7 +335,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || Fog::Compute::VcloudDirector::Defaults::PORT
|
||||
@scheme = options[:scheme] || Fog::Compute::VcloudDirector::Defaults::SCHEME
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@end_point = "#{@scheme}://#{@host}#{@path}/"
|
||||
@api_version = options[:vcloud_director_api_version] || Fog::Compute::VcloudDirector::Defaults::API_VERSION
|
||||
@show_progress = options[:vcloud_director_show_progress]
|
||||
|
@ -670,7 +670,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || Fog::Compute::VcloudDirector::Defaults::PORT
|
||||
@scheme = options[:scheme] || Fog::Compute::VcloudDirector::Defaults::SCHEME
|
||||
#@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
#@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@end_point = "#{@scheme}://#{@host}#{@path}/"
|
||||
@api_version = options[:vcloud_director_api_version] || Fog::Compute::VcloudDirector::Defaults::API_VERSION
|
||||
end
|
||||
|
|
|
@ -86,7 +86,7 @@ module Fog
|
|||
|
||||
@connection_options[:ssl_verify_peer] = false
|
||||
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def request(method_name, options = {})
|
||||
|
|
|
@ -164,7 +164,7 @@ module Fog
|
|||
@host = options[:xenserver_pool_master]
|
||||
@username = options[:xenserver_username]
|
||||
@password = options[:xenserver_password]
|
||||
@connection = Fog::Connection.new(@host)
|
||||
@connection = Fog::XML::Connection.new(@host)
|
||||
@connection.authenticate(@username, @password)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
require "nokogiri"
|
||||
require "fog/core/parser"
|
||||
require "fog/xml/sax_parser_connection"
|
||||
|
||||
module Fog
|
||||
|
||||
|
@ -15,7 +16,14 @@ module Fog
|
|||
# its services
|
||||
#
|
||||
module XML
|
||||
class Connection < Fog::XML::SAXParserConnection
|
||||
def request(params, &block)
|
||||
if (parser = params.delete(:parser))
|
||||
super(parser, params)
|
||||
else
|
||||
original_request(params)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
require "fog/xml/sax_parser_connection"
|
||||
|
|
13
lib/fog/xml/connection.rb
Normal file
13
lib/fog/xml/connection.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
module Fog
|
||||
module XML
|
||||
class Connection < SAXParserConnection
|
||||
def request(params, &block)
|
||||
if (parser = params.delete(:parser))
|
||||
super(parser, params)
|
||||
else
|
||||
original_request(params)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -79,7 +79,7 @@ module Fog
|
|||
@persistent = options[:persistent] || false
|
||||
@port = options[:port] || 80
|
||||
@scheme = options[:scheme] || 'http'
|
||||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
||||
end
|
||||
|
||||
def reload
|
||||
|
|
30
test/fog/xml/connection_test.rb
Normal file
30
test/fog/xml/connection_test.rb
Normal file
|
@ -0,0 +1,30 @@
|
|||
require "minitest/autorun"
|
||||
require "fog"
|
||||
|
||||
# Note this is going to be part of fog-xml eventually
|
||||
class TestFogXMLConnection < MiniTest::Unit::TestCase
|
||||
def setup
|
||||
@connection = Fog::XML::Connection.new("http://localhost")
|
||||
end
|
||||
|
||||
def teardown
|
||||
Excon.stubs.clear
|
||||
end
|
||||
|
||||
def test_respond_to_request
|
||||
assert_respond_to @connection, :request
|
||||
end
|
||||
|
||||
def test_request_with_parser
|
||||
@parser = Fog::ToHashDocument.new
|
||||
Excon.stub({}, { :status => 200, :body => "<xml></xml>" })
|
||||
response = @connection.request(:parser => @parser, :mock => true)
|
||||
assert_equal({ :xml => "" }, response.body)
|
||||
end
|
||||
|
||||
def test_request_without_parser
|
||||
Excon.stub({}, { :status => 200, :body => "<xml></xml>" })
|
||||
response = @connection.request(:mock => true)
|
||||
assert_equal("<xml></xml>", response.body)
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
require "minitest/autorun"
|
||||
|
||||
class HelloWorldTest < Minitest::Test
|
||||
# This is a placeholder to ensure minitest is being picked up by rake
|
||||
def test_truth
|
||||
assert true
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue