From be9ce8a92806dd7c5162aa5158cf4e56a135c325 Mon Sep 17 00:00:00 2001 From: Sergio Rubio Date: Thu, 24 Jan 2013 11:38:45 +0100 Subject: [PATCH] [openstack|identity] Configurable :openstack_endpoint_type :openstack_endpoint_type is missing as a recognized parameter. This patch fixes that, and allows the :openstack_endpoint_type to be configurable instead of hardcoding the value to 'adminURL' That is, you can create the connection to the service as follows: require 'fog' conn = Fog::Identity.new({ :provider => 'OpenStack', :openstack_api_key => ENV['OS_PASSWORD'], :openstack_username => ENV["OS_USERNAME"], :openstack_auth_url => ENV["OS_AUTH_URL"] :openstack_tenant => ENV["OS_TENANT_NAME"], :openstack_endpoint_type => 'publicURL', # publicURL, adminURL, etc }) Defaults to adminURL to maintain backwards compatibility. --- lib/fog/openstack/identity.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/fog/openstack/identity.rb b/lib/fog/openstack/identity.rb index ec80e9ad3..97205dbf7 100644 --- a/lib/fog/openstack/identity.rb +++ b/lib/fog/openstack/identity.rb @@ -8,7 +8,8 @@ module Fog recognizes :openstack_auth_token, :openstack_management_url, :persistent, :openstack_service_type, :openstack_service_name, :openstack_tenant, :openstack_api_key, :openstack_username, :openstack_current_user_id, - :current_user, :current_tenant + :current_user, :current_tenant, + :openstack_endpoint_type model_path 'fog/openstack/models/identity' model :tenant @@ -192,6 +193,8 @@ module Fog @connection_options = options[:connection_options] || {} @openstack_current_user_id = options[:openstack_current_user_id] + + @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL' @current_user = options[:current_user] @current_tenant = options[:current_tenant] @@ -263,7 +266,7 @@ module Fog :openstack_tenant => @openstack_tenant, :openstack_service_type => @openstack_service_type, :openstack_service_name => @openstack_service_name, - :openstack_endpoint_type => 'adminURL' + :openstack_endpoint_type => @openstack_endpoint_type } credentials = Fog::OpenStack.authenticate_v2(options, @connection_options)