change service catalog lookup to be type based

This commit is contained in:
Mike Hagedorn 2014-08-11 16:06:43 -04:00
parent b9b5b23197
commit 3753b5f1a1
6 changed files with 15 additions and 7 deletions

View File

@ -96,7 +96,7 @@ module Fog
### Set an option to use the style of authentication desired; :v1 or :v2 (default) ### Set an option to use the style of authentication desired; :v1 or :v2 (default)
auth_version = options[:hp_auth_version] || :v2 auth_version = options[:hp_auth_version] || :v2
### Pass the service name for block storage to the authentication call ### Pass the service name for block storage to the authentication call
options[:hp_service_type] ||= "Block Storage" options[:hp_service_type] ||= "volume"
@hp_tenant_id = options[:hp_tenant_id] @hp_tenant_id = options[:hp_tenant_id]
@hp_avl_zone = options[:hp_avl_zone] @hp_avl_zone = options[:hp_avl_zone]

View File

@ -244,7 +244,7 @@ module Fog
### Set an option to use the style of authentication desired; :v1 or :v2 (default) ### Set an option to use the style of authentication desired; :v1 or :v2 (default)
auth_version = options[:hp_auth_version] || :v2 auth_version = options[:hp_auth_version] || :v2
### Pass the service name for compute via the options hash ### Pass the service name for compute via the options hash
options[:hp_service_type] ||= "Compute" options[:hp_service_type] ||= "compute"
@hp_tenant_id = options[:hp_tenant_id] @hp_tenant_id = options[:hp_tenant_id]
### Make the authentication call ### Make the authentication call

View File

@ -67,7 +67,7 @@ module Fog
### Set an option to use the style of authentication desired; :v1 or :v2 (default) ### Set an option to use the style of authentication desired; :v1 or :v2 (default)
auth_version = options[:hp_auth_version] || :v2 auth_version = options[:hp_auth_version] || :v2
### Pass the service name for object storage to the authentication call ### Pass the service name for object storage to the authentication call
options[:hp_service_type] ||= "DNS" options[:hp_service_type] ||= "hpext:dns"
@hp_tenant_id = options[:hp_tenant_id] @hp_tenant_id = options[:hp_tenant_id]
@hp_avl_zone = options[:hp_avl_zone] @hp_avl_zone = options[:hp_avl_zone]

View File

@ -101,7 +101,7 @@ module Fog
### Set an option to use the style of authentication desired; :v1 or :v2 (default) ### Set an option to use the style of authentication desired; :v1 or :v2 (default)
auth_version = options[:hp_auth_version] || :v2 auth_version = options[:hp_auth_version] || :v2
### Pass the service name for object storage to the authentication call ### Pass the service name for object storage to the authentication call
options[:hp_service_type] ||= "Load Balancer" options[:hp_service_type] ||= "hpext:lbaas"
@hp_tenant_id = options[:hp_tenant_id] @hp_tenant_id = options[:hp_tenant_id]
@hp_avl_zone = options[:hp_avl_zone] @hp_avl_zone = options[:hp_avl_zone]

View File

@ -125,7 +125,7 @@ module Fog
### Set an option to use the style of authentication desired; :v1 or :v2 (default) ### Set an option to use the style of authentication desired; :v1 or :v2 (default)
auth_version = options[:hp_auth_version] || :v2 auth_version = options[:hp_auth_version] || :v2
### Pass the service name for network to the authentication call ### Pass the service name for network to the authentication call
options[:hp_service_type] ||= "Networking" options[:hp_service_type] ||= "network"
@hp_tenant_id = options[:hp_tenant_id] @hp_tenant_id = options[:hp_tenant_id]
@hp_avl_zone = options[:hp_avl_zone] @hp_avl_zone = options[:hp_avl_zone]
@ -134,6 +134,7 @@ module Fog
# Call the control services authentication # Call the control services authentication
credentials = Fog::HP.authenticate_v2(options, @connection_options) credentials = Fog::HP.authenticate_v2(options, @connection_options)
# the CS service catalog returns the network endpoint # the CS service catalog returns the network endpoint
@hp_network_uri = credentials[:endpoint_url] @hp_network_uri = credentials[:endpoint_url]
@credentials = credentials @credentials = credentials
else else
@ -152,6 +153,7 @@ module Fog
@port = uri.port @port = uri.port
@scheme = uri.scheme @scheme = uri.scheme
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
end end
@ -161,13 +163,19 @@ module Fog
def request(params, parse_json = true, &block) def request(params, parse_json = true, &block)
begin begin
if @path == "/"
#helion network @path is "/"
@calculated_path = "v2.0/#{params[:path]}"
else
@calculated_path = "#{@path}/v2.0/#{params[:path]}"
end
response = @connection.request(params.merge!({ response = @connection.request(params.merge!({
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json', 'Accept' => 'application/json',
'X-Auth-Token' => @auth_token 'X-Auth-Token' => @auth_token
}.merge!(params[:headers] || {}), }.merge!(params[:headers] || {}),
:path => "#{@path}/v2.0/#{params[:path]}" :path => @calculated_path
}), &block) }), &block)
rescue Excon::Errors::HTTPStatusError => error rescue Excon::Errors::HTTPStatusError => error
raise case error raise case error

View File

@ -326,7 +326,7 @@ module Fog
auth_version = auth_version.to_s.downcase.to_sym auth_version = auth_version.to_s.downcase.to_sym
### Pass the service name for object storage to the authentication call ### Pass the service name for object storage to the authentication call
options[:hp_service_type] ||= "Object Storage" options[:hp_service_type] ||= " object-store"
@hp_tenant_id = options[:hp_tenant_id] @hp_tenant_id = options[:hp_tenant_id]
@hp_avl_zone = options[:hp_avl_zone] @hp_avl_zone = options[:hp_avl_zone]