diff --git a/lib/fog/bluebox.rb b/lib/fog/bluebox.rb index 22207bdff..e4ced4ae8 100644 --- a/lib/fog/bluebox.rb +++ b/lib/fog/bluebox.rb @@ -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' diff --git a/lib/fog/bluebox/bin.rb b/lib/fog/bluebox/bin.rb index 355022d3b..2524f019a 100644 --- a/lib/fog/bluebox/bin.rb +++ b/lib/fog/bluebox/bin.rb @@ -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 diff --git a/lib/fog/credentials.rb b/lib/fog/credentials.rb index 288fc94c8..16ff8c5b7 100644 --- a/lib/fog/credentials.rb +++ b/lib/fog/credentials.rb @@ -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