mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Change hp_service_type to check for 'name' in the service catalog rather than 'type'.
This commit is contained in:
parent
0371dea3a4
commit
1ff7b0392d
4 changed files with 11 additions and 10 deletions
|
@ -154,9 +154,9 @@ module Fog
|
|||
### fish out auth_token and endpoint for the service
|
||||
auth_token = body['access']['token']['id']
|
||||
endpoint_url = get_endpoint_from_catalog(body['access']['serviceCatalog'], @hp_service_type, @hp_avl_zone)
|
||||
# If service is Storage, then get the CDN endpoint as well
|
||||
if @hp_service_type == "object-store"
|
||||
cdn_endpoint_url = get_endpoint_from_catalog(body['access']['serviceCatalog'], "hpext:cdn", @hp_avl_zone)
|
||||
# If service is Storage, then get the CDN endpoint as well. 'Name' is unique instead of 'Type'
|
||||
if @hp_service_type == "Object Storage"
|
||||
cdn_endpoint_url = get_endpoint_from_catalog(body['access']['serviceCatalog'], "CDN", @hp_avl_zone)
|
||||
end
|
||||
|
||||
return {
|
||||
|
@ -179,7 +179,8 @@ module Fog
|
|||
def self.get_endpoint_from_catalog(service_catalog, service_type, avl_zone)
|
||||
raise "Unable to parse service catalog." unless service_catalog
|
||||
service_item = service_catalog.detect do |s|
|
||||
s["type"] == service_type
|
||||
# 'Name' is unique instead of 'Type'
|
||||
s["name"] == service_type
|
||||
end
|
||||
if service_item and service_item['endpoints']
|
||||
endpoint = service_item['endpoints'].detect do |ep|
|
||||
|
|
|
@ -58,8 +58,8 @@ module Fog
|
|||
@connection_options = options[:connection_options] || {}
|
||||
### Set an option to use the style of authentication desired; :v1 or :v2 (default)
|
||||
auth_version = options[:hp_auth_version] || :v2
|
||||
### Pass the service type for object storage to the authentication call
|
||||
options[:hp_service_type] = "hpext:cdn"
|
||||
### Pass the service name for object storage to the authentication call
|
||||
options[:hp_service_type] = "CDN"
|
||||
|
||||
### Make the authentication call
|
||||
if (auth_version == :v2)
|
||||
|
|
|
@ -113,8 +113,8 @@ module Fog
|
|||
@connection_options = options[:connection_options] || {}
|
||||
### Set an option to use the style of authentication desired; :v1 or :v2 (default)
|
||||
auth_version = options[:hp_auth_version] || :v2
|
||||
### Pass the service type for compute via the options hash
|
||||
options[:hp_service_type] = "compute"
|
||||
### Pass the service name for compute via the options hash
|
||||
options[:hp_service_type] = "Compute"
|
||||
@hp_tenant_id = options[:hp_tenant_id]
|
||||
|
||||
### Make the authentication call
|
||||
|
|
|
@ -135,8 +135,8 @@ module Fog
|
|||
@connection_options = options[:connection_options] || {}
|
||||
### Set an option to use the style of authentication desired; :v1 or :v2 (default)
|
||||
auth_version = options[:hp_auth_version] || :v2
|
||||
### Pass the service type for object storage to the authentication call
|
||||
options[:hp_service_type] = "object-store"
|
||||
### Pass the service name for object storage to the authentication call
|
||||
options[:hp_service_type] = "Object Storage"
|
||||
@hp_tenant_id = options[:hp_tenant_id]
|
||||
@hp_avl_zone = options[:hp_avl_zone]
|
||||
|
||||
|
|
Loading…
Reference in a new issue