mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[GH-1390] Remove redundant calls to Fog.credentials
If you use the supported means to create services such as: Fog::Service.new(:provider => "Example") It already loads the contents of `~/.fog` and filters the values based on if they are recognised or required. That means in a number of services that are initialising based on `options` or a value from `Fog.credentials` both are the same. The `options` should have been loaded and merged from credentials in the service "builder".
This commit is contained in:
parent
4de05af409
commit
51cb839405
6 changed files with 25 additions and 25 deletions
|
@ -44,9 +44,9 @@ module Fog
|
||||||
class Mock
|
class Mock
|
||||||
|
|
||||||
def initialize(options={})
|
def initialize(options={})
|
||||||
@api_url = options[:glesys_api_url] || Fog.credentials[:glesys_api_url] || API_URL
|
@api_url = options[:glesys_api_url] || API_URL
|
||||||
@glesys_username = options[:glesys_username] || Fog.credentials[:glesys_api_key]
|
@glesys_username = options[:glesys_username]
|
||||||
@glesys_api_key = options[:glesys_api_key] || Fog.credentials[:glesys_api_key]
|
@glesys_api_key = options[:glesys_api_key]
|
||||||
@connection_options = options[:connection_options] || {}
|
@connection_options = options[:connection_options] || {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -74,9 +74,9 @@ module Fog
|
||||||
def initialize(options)
|
def initialize(options)
|
||||||
require 'base64'
|
require 'base64'
|
||||||
|
|
||||||
@api_url = options[:glesys_api_url] || Fog.credentials[:glesys_api_url] || API_URL
|
@api_url = options[:glesys_api_url] || API_URL
|
||||||
@glesys_username = options[:glesys_username] || Fog.credentials[:glesys_api_key]
|
@glesys_username = options[:glesys_username]
|
||||||
@glesys_api_key = options[:glesys_api_key] || Fog.credentials[:glesys_api_key]
|
@glesys_api_key = options[:glesys_api_key]
|
||||||
@connection_options = options[:connection_options] || {}
|
@connection_options = options[:connection_options] || {}
|
||||||
@persistent = options[:persistent] || false
|
@persistent = options[:persistent] || false
|
||||||
@connection = Fog::XML::Connection.new(@api_url, @persistent, @connection_options)
|
@connection = Fog::XML::Connection.new(@api_url, @persistent, @connection_options)
|
||||||
|
|
|
@ -132,8 +132,8 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(options = {})
|
def initialize(options = {})
|
||||||
@joyent_username = options[:joyent_username] || Fog.credentials[:joyent_username]
|
@joyent_username = options[:joyent_username]
|
||||||
@joyent_password = options[:joyent_password] || Fog.credentials[:joyent_password]
|
@joyent_password = options[:joyent_password]
|
||||||
@joyent_url = 'https://us-sw-1.api.joyentcloud.com'
|
@joyent_url = 'https://us-sw-1.api.joyentcloud.com'
|
||||||
@joyent_version = '~7'
|
@joyent_version = '~7'
|
||||||
end
|
end
|
||||||
|
|
|
@ -101,8 +101,8 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(options = {})
|
def initialize(options = {})
|
||||||
@joyent_username = options[:joyent_username] || Fog.credentials[:joyent_username]
|
@joyent_username = options[:joyent_username]
|
||||||
@joyent_password = options[:joyent_password] || Fog.credentials[:joyent_password]
|
@joyent_password = options[:joyent_password]
|
||||||
end
|
end
|
||||||
|
|
||||||
def request(opts)
|
def request(opts)
|
||||||
|
|
|
@ -71,9 +71,9 @@ module Fog
|
||||||
class Mock
|
class Mock
|
||||||
|
|
||||||
def initialize(options)
|
def initialize(options)
|
||||||
@api_url = options[:ninefold_api_url] || Fog.credentials[:ninefold_api_url] || API_URL
|
@api_url = options[:ninefold_api_url] || API_URL
|
||||||
@ninefold_compute_key = options[:ninefold_compute_key] || Fog.credentials[:ninefold_compute_key]
|
@ninefold_compute_key = options[:ninefold_compute_key]
|
||||||
@ninefold_compute_secret = options[:ninefold_compute_secret] || Fog.credentials[:ninefold_compute_secret]
|
@ninefold_compute_secret = options[:ninefold_compute_secret]
|
||||||
end
|
end
|
||||||
|
|
||||||
def request(options)
|
def request(options)
|
||||||
|
@ -84,9 +84,9 @@ module Fog
|
||||||
class Real
|
class Real
|
||||||
|
|
||||||
def initialize(options)
|
def initialize(options)
|
||||||
@api_url = options[:ninefold_api_url] || Fog.credentials[:ninefold_api_url] || API_URL
|
@api_url = options[:ninefold_api_url] || API_URL
|
||||||
@ninefold_compute_key = options[:ninefold_compute_key] || Fog.credentials[:ninefold_compute_key]
|
@ninefold_compute_key = options[:ninefold_compute_key]
|
||||||
@ninefold_compute_secret = options[:ninefold_compute_secret] || Fog.credentials[:ninefold_compute_secret]
|
@ninefold_compute_secret = options[:ninefold_compute_secret]
|
||||||
@connection_options = options[:connection_options] || {}
|
@connection_options = options[:connection_options] || {}
|
||||||
@persistent = options[:persistent] || false
|
@persistent = options[:persistent] || false
|
||||||
@connection = Fog::XML::Connection.new(@api_url, @persistent, @connection_options)
|
@connection = Fog::XML::Connection.new(@api_url, @persistent, @connection_options)
|
||||||
|
|
|
@ -42,8 +42,8 @@ module Fog
|
||||||
class Mock
|
class Mock
|
||||||
|
|
||||||
def initialize(options)
|
def initialize(options)
|
||||||
@serverlove_uuid = options[:serverlove_uuid] || Fog.credentials[:serverlove_uuid]
|
@serverlove_uuid = options[:serverlove_uuid]
|
||||||
@serverlove_api_key = options[:serverlove_api_key] || Fog.credentials[:serverlove_api_key]
|
@serverlove_api_key = options[:serverlove_api_key]
|
||||||
end
|
end
|
||||||
|
|
||||||
def request(options)
|
def request(options)
|
||||||
|
|
|
@ -45,21 +45,21 @@ module Fog
|
||||||
#
|
#
|
||||||
def initialize(options)
|
def initialize(options)
|
||||||
# Currently authentication and api endpoints are the same but may change
|
# Currently authentication and api endpoints are the same but may change
|
||||||
@auth_url = options[:brightbox_auth_url] || Fog.credentials[:brightbox_auth_url] || API_URL
|
@auth_url = options[:brightbox_auth_url] || API_URL
|
||||||
@auth_connection = Fog::Core::Connection.new(@auth_url)
|
@auth_connection = Fog::Core::Connection.new(@auth_url)
|
||||||
|
|
||||||
@api_url = options[:brightbox_api_url] || Fog.credentials[:brightbox_api_url] || API_URL
|
@api_url = options[:brightbox_api_url] || API_URL
|
||||||
@connection_options = options[:connection_options] || {}
|
@connection_options = options[:connection_options] || {}
|
||||||
@persistent = options[:persistent] || false
|
@persistent = options[:persistent] || false
|
||||||
@connection = Fog::Core::Connection.new(@api_url, @persistent, @connection_options)
|
@connection = Fog::Core::Connection.new(@api_url, @persistent, @connection_options)
|
||||||
|
|
||||||
# Authentication options
|
# Authentication options
|
||||||
client_id = options[:brightbox_client_id] || Fog.credentials[:brightbox_client_id]
|
client_id = options[:brightbox_client_id]
|
||||||
client_secret = options[:brightbox_secret] || Fog.credentials[:brightbox_secret]
|
client_secret = options[:brightbox_secret]
|
||||||
|
|
||||||
username = options[:brightbox_username] || Fog.credentials[:brightbox_username]
|
username = options[:brightbox_username]
|
||||||
password = options[:brightbox_password] || Fog.credentials[:brightbox_password]
|
password = options[:brightbox_password]
|
||||||
@configured_account = options[:brightbox_account] || Fog.credentials[:brightbox_account]
|
@configured_account = options[:brightbox_account]
|
||||||
# Request account can be changed at anytime and changes behaviour of future requests
|
# Request account can be changed at anytime and changes behaviour of future requests
|
||||||
@scoped_account = @configured_account
|
@scoped_account = @configured_account
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue