From ffd01e51ddedc28b0639f215391f134d17e27b5f Mon Sep 17 00:00:00 2001 From: geemus Date: Mon, 12 Sep 2011 10:01:48 -0500 Subject: [PATCH] [core] pass connection_options through service init closes #411 --- lib/fog/aws/auto_scaling.rb | 10 ++++++---- lib/fog/aws/cdn.rb | 19 +++++++++---------- lib/fog/aws/cloud_formation.rb | 10 ++++++---- lib/fog/aws/cloud_watch.rb | 10 ++++++---- lib/fog/aws/compute.rb | 14 ++++++++------ lib/fog/aws/dns.rb | 24 ++++++++++++------------ lib/fog/aws/elb.rb | 10 ++++++---- lib/fog/aws/iam.rb | 12 +++++++----- lib/fog/aws/rds.rb | 10 ++++++---- lib/fog/aws/ses.rb | 10 ++++++---- lib/fog/aws/simpledb.rb | 10 ++++++---- lib/fog/aws/sns.rb | 10 ++++++---- lib/fog/aws/sqs.rb | 10 ++++++---- lib/fog/aws/storage.rb | 15 +++++++-------- lib/fog/bluebox/compute.rb | 10 ++++++---- lib/fog/bluebox/dns.rb | 11 ++++++----- lib/fog/brightbox/compute.rb | 12 +++++++----- lib/fog/dnsimple/dns.rb | 10 ++++++---- lib/fog/dnsmadeeasy/dns.rb | 13 ++++++------- lib/fog/dynect/dns.rb | 14 ++++++++------ lib/fog/ecloud/compute.rb | 11 ++++++----- lib/fog/glesys/compute.rb | 10 ++++++---- lib/fog/go_grid/compute.rb | 12 +++++++----- lib/fog/google/storage.rb | 11 +++++------ lib/fog/linode/dns.rb | 10 ++++++---- lib/fog/new_servers/compute.rb | 10 ++++++---- lib/fog/ninefold/compute.rb | 11 ++++++----- lib/fog/ninefold/storage.rb | 7 ++++--- lib/fog/rackspace.rb | 4 ++-- lib/fog/rackspace/cdn.rb | 6 ++++-- lib/fog/rackspace/compute.rb | 6 ++++-- lib/fog/rackspace/dns.rb | 12 ++++++++---- lib/fog/rackspace/load_balancers.rb | 14 ++++++++------ lib/fog/rackspace/storage.rb | 14 ++++++++------ lib/fog/slicehost/compute.rb | 10 ++++++---- lib/fog/slicehost/dns.rb | 10 ++++++---- lib/fog/storm_on_demand/compute.rb | 12 +++++++----- lib/fog/terremark/vcloud.rb | 12 +++++++----- lib/fog/vcloud/compute.rb | 3 ++- lib/fog/voxel/compute.rb | 11 ++++++----- lib/fog/zerigo/dns.rb | 10 ++++++---- 41 files changed, 256 insertions(+), 194 deletions(-) diff --git a/lib/fog/aws/auto_scaling.rb b/lib/fog/aws/auto_scaling.rb index 6eeaea536..46aa1b902 100644 --- a/lib/fog/aws/auto_scaling.rb +++ b/lib/fog/aws/auto_scaling.rb @@ -75,6 +75,7 @@ module Fog @aws_secret_access_key = options[:aws_secret_access_key] @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) + @connection_options = options[:connection_options] || {} options[:region] ||= 'us-east-1' @host = options[:host] || case options[:region] when 'ap-northeast-1' @@ -90,10 +91,11 @@ module Fog else raise ArgumentError, "Unknown region: #{options[:region].inspect}" end - @path = options[:path] || '/' - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent]) + @path = options[:path] || '/' + @port = options[:port] || 443 + @persistent = options[:persistent] || false + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end def reload diff --git a/lib/fog/aws/cdn.rb b/lib/fog/aws/cdn.rb index f05f2a21a..3dedb4301 100644 --- a/lib/fog/aws/cdn.rb +++ b/lib/fog/aws/cdn.rb @@ -84,16 +84,15 @@ module Fog @aws_access_key_id = options[:aws_access_key_id] @aws_secret_access_key = options[:aws_secret_access_key] - @hmac = Fog::HMAC.new('sha1', @aws_secret_access_key) - @host = options[:host] || 'cloudfront.amazonaws.com' - @path = options[:path] || '/' - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @version = options[:version] || '2010-11-01' - unless options.has_key?(:persistent) - options[:persistent] = true - end - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent]) + @connection_options = options[:connection_options] || {} + @hmac = Fog::HMAC.new('sha1', @aws_secret_access_key) + @host = options[:host] || 'cloudfront.amazonaws.com' + @path = options[:path] || '/' + @persistent = options[:persistent] || true + @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) end def reload diff --git a/lib/fog/aws/cloud_formation.rb b/lib/fog/aws/cloud_formation.rb index cff1c4b2c..061fe0602 100644 --- a/lib/fog/aws/cloud_formation.rb +++ b/lib/fog/aws/cloud_formation.rb @@ -51,6 +51,7 @@ module Fog @aws_secret_access_key = options[:aws_secret_access_key] @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) + @connection_options = options[:connection_options] || {} options[:region] ||= 'us-east-1' @host = options[:host] || case options[:region] when 'ap-northeast-1' @@ -66,10 +67,11 @@ module Fog else raise ArgumentError, "Unknown region: #{options[:region].inspect}" end - @path = options[:path] || '/' - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent]) + @path = options[:path] || '/' + @persistent = options[:persistent] || false + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end def reload diff --git a/lib/fog/aws/cloud_watch.rb b/lib/fog/aws/cloud_watch.rb index c2ff84d87..eb90e13ef 100644 --- a/lib/fog/aws/cloud_watch.rb +++ b/lib/fog/aws/cloud_watch.rb @@ -52,6 +52,7 @@ module Fog @aws_secret_access_key = options[:aws_secret_access_key] @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) + @connection_options = options[:connection_options] || {} options[:region] ||= 'us-east-1' @host = options[:host] || case options[:region] when 'ap-northeast-1' @@ -67,10 +68,11 @@ module Fog else raise ArgumentError, "Unknown region: #{options[:region].inspect}" end - @path = options[:path] || '/' - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent]) + @path = options[:path] || '/' + @persistent = options[:persistent] || false + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end def reload diff --git a/lib/fog/aws/compute.rb b/lib/fog/aws/compute.rb index 9af866fe9..444d4aa89 100644 --- a/lib/fog/aws/compute.rb +++ b/lib/fog/aws/compute.rb @@ -226,8 +226,9 @@ module Fog @aws_access_key_id = options[:aws_access_key_id] @aws_secret_access_key = options[:aws_secret_access_key] - @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) - @region = options[:region] ||= 'us-east-1' + @connection_options = options[:connection_options] || {} + @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) + @region = options[:region] ||= 'us-east-1' if @endpoint = options[:endpoint] endpoint = URI.parse(@endpoint) @@ -250,11 +251,12 @@ module Fog else raise ArgumentError, "Unknown region: #{options[:region].inspect}" end - @path = options[:path] || '/' - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' + @path = options[:path] || '/' + @persistent = options[:persistent] || false + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' end - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent]) + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end def reload diff --git a/lib/fog/aws/dns.rb b/lib/fog/aws/dns.rb index f758eeff6..30c1d983f 100644 --- a/lib/fog/aws/dns.rb +++ b/lib/fog/aws/dns.rb @@ -80,18 +80,18 @@ module Fog def initialize(options={}) require 'fog/core/parser' - @aws_access_key_id = options[:aws_access_key_id] - @aws_secret_access_key = options[:aws_secret_access_key] - @hmac = Fog::HMAC.new('sha1', @aws_secret_access_key) - @host = options[:host] || 'route53.amazonaws.com' - @path = options[:path] || '/' - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @version = options[:version] || '2010-10-01' - unless options.has_key?(:persistent) - options[:persistent] = true - end - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent]) + @aws_access_key_id = options[:aws_access_key_id] + @aws_secret_access_key = options[:aws_secret_access_key] + @connection_options = options[:connection_options] || {} + @hmac = Fog::HMAC.new('sha1', @aws_secret_access_key) + @host = options[:host] || 'route53.amazonaws.com' + @path = options[:path] || '/' + @persistent = options[:persistent] || true + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @version = options[:version] || '2010-10-01' + + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end def reload diff --git a/lib/fog/aws/elb.rb b/lib/fog/aws/elb.rb index f6ffa9a8a..b583b031d 100644 --- a/lib/fog/aws/elb.rb +++ b/lib/fog/aws/elb.rb @@ -103,6 +103,7 @@ module Fog @aws_access_key_id = options[:aws_access_key_id] @aws_secret_access_key = options[:aws_secret_access_key] + @connection_options = options[:connection_options] || {} @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) options[:region] ||= 'us-east-1' @@ -120,10 +121,11 @@ module Fog else raise ArgumentError, "Unknown region: #{options[:region].inspect}" end - @path = options[:path] || '/' - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent]) + @path = options[:path] || '/' + @persistent = options[:persistent] || false + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end def reload diff --git a/lib/fog/aws/iam.rb b/lib/fog/aws/iam.rb index 25356c38b..b25206ca6 100644 --- a/lib/fog/aws/iam.rb +++ b/lib/fog/aws/iam.rb @@ -112,12 +112,14 @@ module Fog @aws_access_key_id = options[:aws_access_key_id] @aws_secret_access_key = options[:aws_secret_access_key] + @connection_options = options[:connection_options] || {} @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) - @host = options[:host] || 'iam.amazonaws.com' - @path = options[:path] || '/' - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent]) + @host = options[:host] || 'iam.amazonaws.com' + @path = options[:path] || '/' + @persistent = options[:persistent] || false + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end def reload diff --git a/lib/fog/aws/rds.rb b/lib/fog/aws/rds.rb index 649781749..13ed6b7e4 100644 --- a/lib/fog/aws/rds.rb +++ b/lib/fog/aws/rds.rb @@ -86,6 +86,7 @@ module Fog def initialize(options={}) @aws_access_key_id = options[:aws_access_key_id] @aws_secret_access_key = options[:aws_secret_access_key] + @connection_options = options[:connection_options] || {} @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) options[:region] ||= 'us-east-1' @@ -103,10 +104,11 @@ module Fog else raise ArgumentError, "Unknown region: #{options[:region].inspect}" end - @path = options[:path] || '/' - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent]) + @path = options[:path] || '/' + @persistent = options[:persistent] || false + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end def reload diff --git a/lib/fog/aws/ses.rb b/lib/fog/aws/ses.rb index 466c43e11..b96c19f81 100644 --- a/lib/fog/aws/ses.rb +++ b/lib/fog/aws/ses.rb @@ -49,6 +49,7 @@ module Fog @aws_access_key_id = options[:aws_access_key_id] @aws_secret_access_key = options[:aws_secret_access_key] + @connection_options = options[:connection_options] || {} @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) options[:region] ||= 'us-east-1' @host = options[:host] || case options[:region] @@ -57,10 +58,11 @@ module Fog else raise ArgumentError, "Unknown region: #{options[:region].inspect}" end - @path = options[:path] || '/' - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent]) + @path = options[:path] || '/' + @persistent = options[:persistent] || false + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end def reload diff --git a/lib/fog/aws/simpledb.rb b/lib/fog/aws/simpledb.rb index 1d56b1d21..1b68b7c86 100644 --- a/lib/fog/aws/simpledb.rb +++ b/lib/fog/aws/simpledb.rb @@ -70,6 +70,7 @@ module Fog @aws_access_key_id = options[:aws_access_key_id] @aws_secret_access_key = options[:aws_secret_access_key] + @connection_options = options[:connection_options] || {} @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) @nil_string = options[:nil_string]|| 'nil' @@ -88,10 +89,11 @@ module Fog else raise ArgumentError, "Unknown region: #{options[:region].inspect}" end - @path = options[:path] || '/' - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent]) + @path = options[:path] || '/' + @persistent = options[:persistent] || false + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end private diff --git a/lib/fog/aws/sns.rb b/lib/fog/aws/sns.rb index ac1670463..572f0b68e 100644 --- a/lib/fog/aws/sns.rb +++ b/lib/fog/aws/sns.rb @@ -52,6 +52,7 @@ module Fog require 'multi_json' @aws_access_key_id = options[:aws_access_key_id] @aws_secret_access_key = options[:aws_secret_access_key] + @connection_options = options[:connection_options] || {} @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) options[:region] ||= 'us-east-1' @@ -68,10 +69,11 @@ module Fog raise ArgumentError, "Unknown region: #{options[:region].inspect}" end - @path = options[:path] || '/' - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent]) + @path = options[:path] || '/' + @persistent = options[:persistent] || false + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end def reload diff --git a/lib/fog/aws/sqs.rb b/lib/fog/aws/sqs.rb index 9259c2096..fe2a7b004 100644 --- a/lib/fog/aws/sqs.rb +++ b/lib/fog/aws/sqs.rb @@ -48,6 +48,7 @@ module Fog def initialize(options={}) @aws_access_key_id = options[:aws_access_key_id] @aws_secret_access_key = options[:aws_secret_access_key] + @connection_options = options[:connection_options] || {} @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) options[:region] ||= 'us-east-1' @host = options[:host] || case options[:region] @@ -62,10 +63,11 @@ module Fog else raise ArgumentError, "Unknown region: #{options[:region].inspect}" end - @path = options[:path] || '/' - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent]) + @path = options[:path] || '/' + @persistent = options[:persistent] || false + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end def reload diff --git a/lib/fog/aws/storage.rb b/lib/fog/aws/storage.rb index 060ddbb9e..d110e02a6 100644 --- a/lib/fog/aws/storage.rb +++ b/lib/fog/aws/storage.rb @@ -245,6 +245,7 @@ module Fog @aws_access_key_id = options[:aws_access_key_id] @aws_secret_access_key = options[:aws_secret_access_key] + @connection_options = options[:connection_options] || {} @hmac = Fog::HMAC.new('sha1', @aws_secret_access_key) if @endpoint = options[:endpoint] endpoint = URI.parse(@endpoint) @@ -268,14 +269,12 @@ module Fog else raise ArgumentError, "Unknown region: #{options[:region].inspect}" end - @path = options[:path] || '/' - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - unless options.has_key?(:persistent) - options[:persistent] = true - end + @path = options[:path] || '/' + @persistent = options[:persistent] || true + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' end - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent]) + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) end def reload @@ -368,7 +367,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).request(original_params, &block) + response = Fog::Connection.new("#{@scheme}://#{uri.host}:#{@port}", false, @connection_options).request(original_params, &block) end response diff --git a/lib/fog/bluebox/compute.rb b/lib/fog/bluebox/compute.rb index fb08687e4..02b6efe1b 100644 --- a/lib/fog/bluebox/compute.rb +++ b/lib/fog/bluebox/compute.rb @@ -61,10 +61,12 @@ module Fog require 'multi_json' @bluebox_api_key = options[:bluebox_api_key] @bluebox_customer_id = options[:bluebox_customer_id] - @host = options[:bluebox_host] || "boxpanel.bluebox.net" - @port = options[:bluebox_port] || 443 - @scheme = options[:bluebox_scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) + @connection_options = options[:connection_options] || {} + @host = options[:bluebox_host] || "boxpanel.bluebox.net" + @persistent = options[:persistent] || false + @port = options[:bluebox_port] || 443 + @scheme = options[:bluebox_scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def reload diff --git a/lib/fog/bluebox/dns.rb b/lib/fog/bluebox/dns.rb index 81107539c..29e4385c7 100644 --- a/lib/fog/bluebox/dns.rb +++ b/lib/fog/bluebox/dns.rb @@ -55,11 +55,12 @@ module Fog def initialize(options ={}) @bluebox_customer_id = options[:bluebox_customer_id] @bluebox_api_key = options[:bluebox_api_key] - - @host = options[:bluebox_host] || "boxpanel.bluebox.net" - @port = options[:bluebox_port] || 443 - @scheme = options[:bluebox_scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) + @connection_options = options[:connection_options] || {} + @host = options[:bluebox_host] || "boxpanel.bluebox.net" + @persistent = options[:persistent] || false + @port = options[:bluebox_port] || 443 + @scheme = options[:bluebox_scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def reload diff --git a/lib/fog/brightbox/compute.rb b/lib/fog/brightbox/compute.rb index 654d15648..17824eb7f 100644 --- a/lib/fog/brightbox/compute.rb +++ b/lib/fog/brightbox/compute.rb @@ -101,11 +101,13 @@ module Fog def initialize(options) require 'multi_json' # Currently authentication and api endpoints are the same but may change - @auth_url = options[:brightbox_auth_url] || Fog.credentials[:brightbox_auth_url] || API_URL - @api_url = options[:brightbox_api_url] || Fog.credentials[:brightbox_api_url] || API_URL - @brightbox_client_id = options[:brightbox_client_id] || Fog.credentials[:brightbox_client_id] - @brightbox_secret = options[:brightbox_secret] || Fog.credentials[:brightbox_secret] - @connection = Fog::Connection.new(@api_url) + @auth_url = options[:brightbox_auth_url] || Fog.credentials[:brightbox_auth_url] || API_URL + @api_url = options[:brightbox_api_url] || Fog.credentials[:brightbox_api_url] || API_URL + @connection_options = options[:connection_options] || {} + @brightbox_client_id = options[:brightbox_client_id] || Fog.credentials[:brightbox_client_id] + @brightbox_secret = options[:brightbox_secret] || Fog.credentials[:brightbox_secret] + @persistent = options[:peristent] || false + @connection = Fog::Connection.new(@api_url, @persistent, @connection_options) end def request(method, url, expected_responses, options = nil) diff --git a/lib/fog/dnsimple/dns.rb b/lib/fog/dnsimple/dns.rb index a0aa92e48..e47ea5a2f 100644 --- a/lib/fog/dnsimple/dns.rb +++ b/lib/fog/dnsimple/dns.rb @@ -59,16 +59,18 @@ module Fog @dnsimple_email = options[:dnsimple_email] @dnsimple_password = options[:dnsimple_password] + @connection_options = options[:connection_options] || {} if options[:dnsimple_url] uri = URI.parse(options[:dnsimple_url]) options[:host] = uri.host options[:port] = uri.port options[:scheme] = uri.scheme end - @host = options[:host] || "dnsimple.com" - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) + @host = options[:host] || "dnsimple.com" + @persistent = options[:persistent] || false + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def reload diff --git a/lib/fog/dnsmadeeasy/dns.rb b/lib/fog/dnsmadeeasy/dns.rb index ff3964de7..34be6f2dc 100644 --- a/lib/fog/dnsmadeeasy/dns.rb +++ b/lib/fog/dnsmadeeasy/dns.rb @@ -84,13 +84,12 @@ module Fog @dnsmadeeasy_api_key = options[:dnsmadeeasy_api_key] @dnsmadeeasy_secret_key = options[:dnsmadeeasy_secret_key] - @host = options[:host] || 'api.dnsmadeeasy.com' - @port = options[:port] || 80 #443 Not yet - @scheme = options[:scheme] || 'http' #'https Not yet - unless options.has_key?(:persistent) - options[:persistent] = true - end - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) + @connection_options = options[:connection_options] || {} + @host = options[:host] || 'api.dnsmadeeasy.com' + @persistent = options[: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) end def reload diff --git a/lib/fog/dynect/dns.rb b/lib/fog/dynect/dns.rb index c8d30a176..80d758e82 100644 --- a/lib/fog/dynect/dns.rb +++ b/lib/fog/dynect/dns.rb @@ -64,12 +64,14 @@ module Fog @dynect_username = options[:dynect_username] @dynect_password = options[:dynect_password] - @host = "api2.dynect.net" - @port = options[:port] || 443 - @path = options[:path] || '/REST' - @scheme = options[:scheme] || 'https' - @version = options[:version] || '2.3.1' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent] || true) + @connection_options = options[:connection_options] || {} + @host = "api2.dynect.net" + @port = options[:port] || 443 + @path = options[:path] || '/REST' + @persistent = options[:persistent] || true + @scheme = options[:scheme] || 'https' + @version = options[:version] || '2.3.1' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def auth_token diff --git a/lib/fog/ecloud/compute.rb b/lib/fog/ecloud/compute.rb index 96fa8a267..9eb71c56f 100644 --- a/lib/fog/ecloud/compute.rb +++ b/lib/fog/ecloud/compute.rb @@ -1144,11 +1144,12 @@ module Fog require 'fog/core/parser' @connections = {} + @connection_options = options[:connection_options] || {} @versions_uri = URI.parse(options[:ecloud_versions_uri]) - @version = options[:ecloud_version] - @username = options[:ecloud_username] - @password = options[:ecloud_password] - @persistent = options[:persistent] + @version = options[:ecloud_version] + @username = options[:ecloud_username] + @password = options[:ecloud_password] + @persistent = options[:persistent] || false end def default_organization_uri @@ -1268,7 +1269,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) + @connections[host_url] ||= Fog::Connection.new(host_url, @persistent, @connection_options) # Set headers to an empty hash if none are set. headers = params[:headers] || {} diff --git a/lib/fog/glesys/compute.rb b/lib/fog/glesys/compute.rb index f6fa3abc4..9211f0dea 100644 --- a/lib/fog/glesys/compute.rb +++ b/lib/fog/glesys/compute.rb @@ -52,10 +52,12 @@ module Fog require 'multi_json' require 'base64' - @api_url = options[:glesys_api_url] || Fog.credentials[:glesys_api_url] || API_URL - @glesys_username = options[:glesys_username] || Fog.credentials[:glesys_api_key] - @glesys_api_key = options[:glesys_api_key] || Fog.credentials[:glesys_api_key] - @connection = Fog::Connection.new(@api_url) + @api_url = options[:glesys_api_url] || Fog.credentials[:glesys_api_url] || API_URL + @glesys_username = options[:glesys_username] || Fog.credentials[:glesys_api_key] + @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) end def request(method_name, options = {}) diff --git a/lib/fog/go_grid/compute.rb b/lib/fog/go_grid/compute.rb index 4911a6f21..ce786d4cd 100644 --- a/lib/fog/go_grid/compute.rb +++ b/lib/fog/go_grid/compute.rb @@ -64,11 +64,13 @@ module Fog require 'multi_json' @go_grid_api_key = options[:go_grid_api_key] @go_grid_shared_secret = options[:go_grid_shared_secret] - @host = options[:host] || "api.gogrid.com" - @path = options[:path] || "/api" - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) + @connection_options = options[:connection_options] || {} + @host = options[:host] || "api.gogrid.com" + @path = options[:path] || "/api" + @persistent = options[:persistent] || false + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def reload diff --git a/lib/fog/google/storage.rb b/lib/fog/google/storage.rb index 038a88588..fd36b192b 100644 --- a/lib/fog/google/storage.rb +++ b/lib/fog/google/storage.rb @@ -189,14 +189,13 @@ module Fog @google_storage_access_key_id = options[:google_storage_access_key_id] @google_storage_secret_access_key = options[:google_storage_secret_access_key] + @connection_options = options[:connection_options] || {} @hmac = Fog::HMAC.new('sha1', @google_storage_secret_access_key) @host = options[:host] || 'commondatastorage.googleapis.com' - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - unless options.has_key?(:persistent) - options[:persistent] = true - end - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) + @persistent = options[:persistent] || true + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def reload diff --git a/lib/fog/linode/dns.rb b/lib/fog/linode/dns.rb index 3b0065976..496d27fcb 100644 --- a/lib/fog/linode/dns.rb +++ b/lib/fog/linode/dns.rb @@ -54,11 +54,13 @@ module Fog def initialize(options={}) require 'multi_json' + @connection_options = options[:connection_options] || {} + @host = options[:host] || "api.linode.com" @linode_api_key = options[:linode_api_key] - @host = options[:host] || "api.linode.com" - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) + @persistent = options[:persistent] || false + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def reload diff --git a/lib/fog/new_servers/compute.rb b/lib/fog/new_servers/compute.rb index e6cf4665b..a5449a4d6 100644 --- a/lib/fog/new_servers/compute.rb +++ b/lib/fog/new_servers/compute.rb @@ -52,10 +52,12 @@ module Fog @new_servers_password = options[:new_servers_password] @new_servers_username = options[:new_servers_username] - @host = options[:host] || "noc.newservers.com" - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) + @connection_options = options[:connection_options] || {} + @host = options[:host] || "noc.newservers.com" + @persistent = options[:persistent] || false + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def reload diff --git a/lib/fog/ninefold/compute.rb b/lib/fog/ninefold/compute.rb index 819b1b988..a3090ec7e 100644 --- a/lib/fog/ninefold/compute.rb +++ b/lib/fog/ninefold/compute.rb @@ -68,7 +68,6 @@ module Fog @api_url = options[:ninefold_api_url] || Fog.credentials[:ninefold_api_url] || API_URL @ninefold_compute_key = options[:ninefold_compute_key] || Fog.credentials[:ninefold_compute_key] @ninefold_compute_secret = options[:ninefold_compute_secret] || Fog.credentials[:ninefold_compute_secret] - @connection = Fog::Connection.new(@api_url) end def request(options) @@ -81,10 +80,12 @@ module Fog def initialize(options) require 'multi_json' - @api_url = options[:ninefold_api_url] || Fog.credentials[:ninefold_api_url] || API_URL - @ninefold_compute_key = options[:ninefold_compute_key] || Fog.credentials[:ninefold_compute_key] - @ninefold_compute_secret = options[:ninefold_compute_secret] || Fog.credentials[:ninefold_compute_secret] - @connection = Fog::Connection.new(@api_url) + @api_url = options[:ninefold_api_url] || Fog.credentials[:ninefold_api_url] || API_URL + @ninefold_compute_key = options[:ninefold_compute_key] || Fog.credentials[:ninefold_compute_key] + @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) end def request(command, params, options) diff --git a/lib/fog/ninefold/storage.rb b/lib/fog/ninefold/storage.rb index 251586037..e51349fcc 100644 --- a/lib/fog/ninefold/storage.rb +++ b/lib/fog/ninefold/storage.rb @@ -51,10 +51,11 @@ module Fog @ninefold_storage_secret = options[:ninefold_storage_secret] @ninefold_storage_secret_decoded = Base64.decode64( @ninefold_storage_secret ) - @hmac = Fog::HMAC.new('sha1', @ninefold_storage_secret_decoded) + @connection_options = options[:connection_options] || {} + @hmac = Fog::HMAC.new('sha1', @ninefold_storage_secret_decoded) + @persistent = options[:persistent] || true - Excon.ssl_verify_peer = false if options[:rackspace_servicenet] == true - @connection = Fog::Connection.new("#{Fog::Storage::Ninefold::STORAGE_SCHEME}://#{Fog::Storage::Ninefold::STORAGE_HOST}:#{Fog::Storage::Ninefold::STORAGE_PORT}", true) # persistent + @connection = Fog::Connection.new("#{Fog::Storage::Ninefold::STORAGE_SCHEME}://#{Fog::Storage::Ninefold::STORAGE_HOST}:#{Fog::Storage::Ninefold::STORAGE_PORT}", @persistent, @connection_options) end def uid diff --git a/lib/fog/rackspace.rb b/lib/fog/rackspace.rb index d7f1c29f4..33ebe9a22 100644 --- a/lib/fog/rackspace.rb +++ b/lib/fog/rackspace.rb @@ -48,12 +48,12 @@ module Fog service(:storage, 'rackspace/storage') service(:load_balancers, 'rackspace/load_balancers') - def self.authenticate(options) + def self.authenticate(options, connection_options = {}) rackspace_auth_url = options[:rackspace_auth_url] || "auth.api.rackspacecloud.com" url = rackspace_auth_url.match(/^https?:/) ? \ rackspace_auth_url : 'https://' + rackspace_auth_url uri = URI.parse(url) - connection = Fog::Connection.new(url) + connection = Fog::Connection.new(url, false, connection_options) @rackspace_api_key = options[:rackspace_api_key] @rackspace_username = options[:rackspace_username] response = connection.request({ diff --git a/lib/fog/rackspace/cdn.rb b/lib/fog/rackspace/cdn.rb index f082dedd4..665b9ac8a 100644 --- a/lib/fog/rackspace/cdn.rb +++ b/lib/fog/rackspace/cdn.rb @@ -46,9 +46,11 @@ module Fog def initialize(options={}) require 'multi_json' - credentials = Fog::Rackspace.authenticate(options) + @connection_options = options[:connection_options] || {} + credentials = Fog::Rackspace.authenticate(options, @connection_options) @auth_token = credentials['X-Auth-Token'] @enabled = false + @persistent = options[:persistent] || false if credentials['X-CDN-Management-Url'] uri = URI.parse(credentials['X-CDN-Management-Url']) @@ -56,7 +58,7 @@ module Fog @path = uri.path @port = uri.port @scheme = uri.scheme - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) @enabled = true end end diff --git a/lib/fog/rackspace/compute.rb b/lib/fog/rackspace/compute.rb index 08ba6bc26..0666852d9 100644 --- a/lib/fog/rackspace/compute.rb +++ b/lib/fog/rackspace/compute.rb @@ -86,9 +86,11 @@ module Fog @rackspace_auth_token = options[:rackspace_auth_token] @rackspace_management_url = options[:rackspace_management_url] @rackspace_must_reauthenticate = false + @connection_options = options[:connection_options] || {} authenticate Excon.ssl_verify_peer = false if options[:rackspace_servicenet] == true - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) + @persistent = options[:persistent] || false + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def reload @@ -137,7 +139,7 @@ module Fog :rackspace_username => @rackspace_username, :rackspace_auth_url => @rackspace_auth_url } - credentials = Fog::Rackspace.authenticate(options) + credentials = Fog::Rackspace.authenticate(options, @connection_options) @auth_token = credentials['X-Auth-Token'] uri = URI.parse(credentials['X-Server-Management-Url']) else diff --git a/lib/fog/rackspace/dns.rb b/lib/fog/rackspace/dns.rb index 60924b20c..3172cbdbf 100644 --- a/lib/fog/rackspace/dns.rb +++ b/lib/fog/rackspace/dns.rb @@ -44,13 +44,17 @@ module Fog @rackspace_api_key = options[:rackspace_api_key] @rackspace_username = options[:rackspace_username] @rackspace_auth_url = options[:rackspace_auth_url] + @connection_options = options[:connection_options] || {} uri = URI.parse(options[:rackspace_dns_endpoint] || US_ENDPOINT) @auth_token, @account_id = *authenticate - @path = "#{uri.path}/#{@account_id}" - headers = { 'Content-Type' => 'application/json', 'X-Auth-Token' => @auth_token } + @persistent = options[:persistent] || false + @path = "#{uri.path}/#{@account_id}" - @connection = Fog::Connection.new(uri.to_s, options[:persistent], { :headers => headers}) + @connection_options[:headers] ||= {} + @connection_options[:headers].merge!({ 'Content-Type' => 'application/json', 'X-Auth-Token' => @auth_token }) + + @connection = Fog::Connection.new(uri.to_s, @persistent, @connection_options) end private @@ -82,7 +86,7 @@ module Fog :rackspace_username => @rackspace_username, :rackspace_auth_url => @rackspace_auth_url } - credentials = Fog::Rackspace.authenticate(options) + credentials = Fog::Rackspace.authenticate(options, @connection_options) auth_token = credentials['X-Auth-Token'] account_id = credentials['X-Server-Management-Url'].match(/.*\/([\d]+)$/)[1] [auth_token, account_id] diff --git a/lib/fog/rackspace/load_balancers.rb b/lib/fog/rackspace/load_balancers.rb index 851ecb545..039de2564 100644 --- a/lib/fog/rackspace/load_balancers.rb +++ b/lib/fog/rackspace/load_balancers.rb @@ -98,15 +98,17 @@ module Fog @rackspace_username = options[:rackspace_username] @rackspace_auth_url = options[:rackspace_auth_url] @rackspace_must_reauthenticate = false + @connection_options = options[:connection_options] || {} uri = URI.parse(options[:rackspace_lb_endpoint] || DFW_ENDPOINT) - @host = uri.host - @path = uri.path - @port = uri.port - @scheme = uri.scheme + @host = uri.host + @persistent = options[:persistent] || false + @path = uri.path + @port = uri.port + @scheme = uri.scheme authenticate - @connection = Fog::Connection.new(uri.to_s, options[:persistent]) + @connection = Fog::Connection.new(uri.to_s, @persistent, @connection_options) end def request(params) @@ -141,7 +143,7 @@ module Fog :rackspace_username => @rackspace_username, :rackspace_auth_url => @rackspace_auth_url } - credentials = Fog::Rackspace.authenticate(options) + credentials = Fog::Rackspace.authenticate(options, @connection_options) @auth_token = credentials['X-Auth-Token'] account_id = credentials['X-Server-Management-Url'].match(/.*\/([\d]+)$/)[1] @path = "#{@path}/#{account_id}" diff --git a/lib/fog/rackspace/storage.rb b/lib/fog/rackspace/storage.rb index 0633d4755..f55986890 100644 --- a/lib/fog/rackspace/storage.rb +++ b/lib/fog/rackspace/storage.rb @@ -83,16 +83,18 @@ module Fog @rackspace_username = options[:rackspace_username] @rackspace_cdn_ssl = options[:rackspace_cdn_ssl] @rackspace_auth_url = options[:rackspace_auth_url] - credentials = Fog::Rackspace.authenticate(options) + @connection_options = options[:connection_options] || {} + credentials = Fog::Rackspace.authenticate(options, @connection_options) @auth_token = credentials['X-Auth-Token'] uri = URI.parse(credentials['X-Storage-Url']) - @host = options[:rackspace_servicenet] == true ? "snet-#{uri.host}" : uri.host - @path = uri.path - @port = uri.port - @scheme = uri.scheme + @host = options[:rackspace_servicenet] == true ? "snet-#{uri.host}" : uri.host + @path = uri.path + @persistent = options[:persistent] || false + @port = uri.port + @scheme = uri.scheme Excon.ssl_verify_peer = false if options[:rackspace_servicenet] == true - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def reload diff --git a/lib/fog/slicehost/compute.rb b/lib/fog/slicehost/compute.rb index c298b5288..2ccbf64ab 100644 --- a/lib/fog/slicehost/compute.rb +++ b/lib/fog/slicehost/compute.rb @@ -60,10 +60,12 @@ module Fog require 'fog/core/parser' @slicehost_password = options[:slicehost_password] - @host = options[:host] || "api.slicehost.com" - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) + @connection_options = options[:connection_options] || {} + @host = options[:host] || "api.slicehost.com" + @persistent = options[:persistent] || false + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def reload diff --git a/lib/fog/slicehost/dns.rb b/lib/fog/slicehost/dns.rb index 1da56802e..405d5f6d9 100644 --- a/lib/fog/slicehost/dns.rb +++ b/lib/fog/slicehost/dns.rb @@ -56,10 +56,12 @@ module Fog require 'fog/core/parser' @slicehost_password = options[:slicehost_password] - @host = options[:host] || "api.slicehost.com" - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) + @connection_options = options[:connection_options] || {} + @host = options[:host] || "api.slicehost.com" + @persistent = options[:persistent] || false + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def reload diff --git a/lib/fog/storm_on_demand/compute.rb b/lib/fog/storm_on_demand/compute.rb index bdcfd6e51..f0e9a0df5 100644 --- a/lib/fog/storm_on_demand/compute.rb +++ b/lib/fog/storm_on_demand/compute.rb @@ -87,13 +87,15 @@ module Fog def initialize(options={}) require 'multi_json' uri = URI.parse(options[:storm_on_demand_auth_url] ||= API_URL) - @host = uri.host - @path = uri.path - @port = uri.port - @scheme = uri.scheme + @connection_options = options[:connection_options] || {} + @host = uri.host + @path = uri.path + @persistent = options[:persistent] || false + @port = uri.port + @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}") + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def reload diff --git a/lib/fog/terremark/vcloud.rb b/lib/fog/terremark/vcloud.rb index 4b08a71ca..de3c3bee0 100644 --- a/lib/fog/terremark/vcloud.rb +++ b/lib/fog/terremark/vcloud.rb @@ -39,11 +39,13 @@ module Fog def initialize(options={}) @terremark_password = options[:terremark_vcloud_password] @terremark_username = options[:terremark_vcloud_username] - @host = options[:host] || Fog::Terremark::Vcloud::Defaults::HOST - @path = options[:path] || Fog::Terremark::Vcloud::Defaults::PATH - @port = options[:port] || Fog::Terremark::Vcloud::Defaults::PORT - @scheme = options[:scheme] || Fog::Terremark::Vcloud::Defaults::SCHEME - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) + @connection_options = options[:connection_options] || {} + @host = options[:host] || Fog::Terremark::Vcloud::Defaults::HOST + @path = options[:path] || Fog::Terremark::Vcloud::Defaults::PATH + @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) end def default_vdc_id diff --git a/lib/fog/vcloud/compute.rb b/lib/fog/vcloud/compute.rb index 84ee6065a..696c7e831 100644 --- a/lib/fog/vcloud/compute.rb +++ b/lib/fog/vcloud/compute.rb @@ -162,6 +162,7 @@ module Fog require 'fog/core/parser' @connections = {} + @connection_options = options[:connection_options] || {} @persistent = options[:persistent] @username = options[:vcloud_username] @@ -268,7 +269,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) + @connections[host_url] ||= Fog::Connection.new(host_url, @persistent, @connection_options) # Set headers to an empty hash if none are set. headers = params[:headers] || {} diff --git a/lib/fog/voxel/compute.rb b/lib/fog/voxel/compute.rb index ba3774c7a..d04629e64 100644 --- a/lib/fog/voxel/compute.rb +++ b/lib/fog/voxel/compute.rb @@ -79,14 +79,15 @@ module Fog @voxel_api_key = options[:voxel_api_key] @voxel_api_secret = options[:voxel_api_secret] - @host = options[:host] || "api.voxel.net" - @port = options[:port] || 443 - @scheme = options[:scheme] || 'https' - @persistent = options[:persistent] || false + @connection_options = options[:connection_options] || {} + @host = options[:host] || "api.voxel.net" + @port = options[:port] || 443 + @scheme = options[:scheme] || 'https' + @persistent = options[:persistent] || false Excon.ssl_verify_peer = false - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent) + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def request(method_name, options = {}) diff --git a/lib/fog/zerigo/dns.rb b/lib/fog/zerigo/dns.rb index c20a15956..5acbbcbed 100644 --- a/lib/fog/zerigo/dns.rb +++ b/lib/fog/zerigo/dns.rb @@ -64,10 +64,12 @@ module Fog @zerigo_email = options[:zerigo_email] @zerigo_token = options[:zerigo_token] - @host = options[:host] || "ns.zerigo.com" - @port = options[:port] || 80 - @scheme = options[:scheme] || 'http' - @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent]) + @connection_options = options[:connection_options] || {} + @host = options[:host] || "ns.zerigo.com" + @persistent = options[:persistent] || false + @port = options[:port] || 80 + @scheme = options[:scheme] || 'http' + @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end def reload