mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Enable compute service with HP provider. Refactor hp_auth_url into hp_host, hp_port and hp_auth_path to enable flexibility in specifying the host, port and auth path separately.
This commit is contained in:
parent
daef1b341a
commit
b94ece2bc6
1 changed files with 9 additions and 4 deletions
|
@ -6,12 +6,16 @@ module Fog
|
|||
extend Fog::Provider
|
||||
|
||||
#service(:cdn, 'cdn/rackspace')
|
||||
#service(:compute, 'compute/rackspace')
|
||||
service(:compute, 'compute/hp')
|
||||
service(:storage, 'storage/hp')
|
||||
|
||||
def self.authenticate(options)
|
||||
scheme = options[:scheme] || "http://"
|
||||
hp_auth_url = options[:hp_auth_url] || "auth.api.rackspacecloud.com"
|
||||
#hp_auth_url = options[:hp_auth_url] || "auth.api.rackspacecloud.com"
|
||||
@hp_host = options[:hp_host] || "auth.api.rackspacecloud.com"
|
||||
@hp_port = options[:hp_port] || "80"
|
||||
@hp_auth_path = options[:hp_auth_path] || "auth/v1.0"
|
||||
hp_auth_url = "#{@hp_host}:#{@hp_port}"
|
||||
connection = Fog::Connection.new(scheme + hp_auth_url)
|
||||
@hp_username = options[:hp_username]
|
||||
@hp_password = options[:hp_password]
|
||||
|
@ -21,9 +25,10 @@ module Fog
|
|||
'X-Auth-Key' => @hp_password,
|
||||
'X-Auth-User' => @hp_username
|
||||
},
|
||||
:host => hp_auth_url,
|
||||
:host => @hp_host,
|
||||
:port => @hp_port,
|
||||
:method => 'GET',
|
||||
:path => 'auth/v1.0'
|
||||
:path => @hp_auth_path
|
||||
})
|
||||
response.headers.reject do |key, value|
|
||||
!['X-Server-Management-Url', 'X-Storage-Url', 'X-CDN-Management-Url', 'X-Auth-Token'].include?(key)
|
||||
|
|
Loading…
Reference in a new issue