mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[bbg] update credentials to include customer_id
This commit is contained in:
parent
99556435d1
commit
2e4ed63eaf
3 changed files with 8 additions and 4 deletions
|
@ -15,10 +15,12 @@ module Fog
|
|||
require 'fog/bluebox/requests/reboot_block'
|
||||
|
||||
def self.new(options={})
|
||||
|
||||
unless options[:bluebox_api_key]
|
||||
raise ArgumentError.new('bluebox_api_key is required to access Blue Box')
|
||||
end
|
||||
unless options[:bluebox_customer_id]
|
||||
raise ArgumentError.new('bluebox_customer_id is required to access Blue Box')
|
||||
end
|
||||
if Fog.mocking?
|
||||
Fog::Bluebox::Mock.new(options)
|
||||
else
|
||||
|
@ -54,7 +56,8 @@ module Fog
|
|||
class Real
|
||||
|
||||
def initialize(options={})
|
||||
@bluebox_api_key = options[:bluebox_api_key]
|
||||
@bluebox_api_key = options[:bluebox_api_key]
|
||||
@bluebox_customer_id = options[:bluebox_customer_id]
|
||||
@host = options[:bluebox_host] || "boxpanel.blueboxgrp.com"
|
||||
@port = options[:bluebox_port] || 443
|
||||
@scheme = options[:bluebox_scheme] || 'https'
|
||||
|
@ -64,7 +67,7 @@ module Fog
|
|||
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}")
|
||||
params[:headers] ||= {}
|
||||
params[:headers].merge!({
|
||||
'Authorization' => "Basic #{Base64.encode64(@bluebox_api_key).delete("\r\n")}"
|
||||
'Authorization' => "Basic #{Base64.encode64([@bluebox_customer_id, @bluebox_api_key].join(':')).delete("\r\n")}"
|
||||
})
|
||||
case params[:method]
|
||||
when 'DELETE', 'GET', 'HEAD'
|
||||
|
|
|
@ -10,7 +10,7 @@ module Bluebox
|
|||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
credentials = Fog.credentials.reject do |k,v|
|
||||
![:bluebox_api_key, :bluebox_host, :bluebox_port, :bluebox_scheme].include?(k)
|
||||
![:bluebox_api_key, :bluebox_customer_id].include?(k)
|
||||
end
|
||||
hash[key] = case key
|
||||
when :blocks
|
||||
|
|
|
@ -32,6 +32,7 @@ module Fog
|
|||
:aws_access_key_id: INTENTIONALLY_LEFT_BLANK
|
||||
:aws_secret_access_key: INTENTIONALLY_LEFT_BLANK
|
||||
:bluebox_api_key: INTENTIONALLY_LEFT_BLANK
|
||||
:bluebox_customer_id: INTENTIONALLY_LEFT_BLANK
|
||||
:local_root: INTENTIONALLY_LEFT_BLANK
|
||||
:rackspace_api_key: INTENTIONALLY_LEFT_BLANK
|
||||
:rackspace_username: INTENTIONALLY_LEFT_BLANK
|
||||
|
|
Loading…
Add table
Reference in a new issue