From 291c0e2da3b8c8f4f2c4d0ad1b2bd879f768567a Mon Sep 17 00:00:00 2001 From: Sergio Rubio Date: Fri, 1 Feb 2013 10:32:37 +0100 Subject: [PATCH] [openstack|compute] 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 'publicURL' That is, you can create the connection to the service as follows: require 'fog' conn = Fog::Compute.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 => 'adminURL', # publicURL, adminURL, etc }) Defaults to publicURL to maintain backwards compatibility. --- lib/fog/openstack/compute.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/fog/openstack/compute.rb b/lib/fog/openstack/compute.rb index c5adfd2fb..88d72c460 100644 --- a/lib/fog/openstack/compute.rb +++ b/lib/fog/openstack/compute.rb @@ -10,7 +10,8 @@ module Fog :persistent, :openstack_service_type, :openstack_service_name, :openstack_tenant, :openstack_api_key, :openstack_username, :openstack_identity_endpoint, - :current_user, :current_tenant, :openstack_region + :current_user, :current_tenant, :openstack_region, + :openstack_endpoint_type ## MODELS # @@ -294,6 +295,7 @@ module Fog @openstack_service_type = options[:openstack_service_type] || ['nova', 'compute'] @openstack_service_name = options[:openstack_service_name] @openstack_identity_service_type = options[:openstack_identity_service_type] || 'identity' + @openstack_endpoint_type = options[:openstack_endpoint_type] || 'publicURL' @openstack_region = options[:openstack_region] @connection_options = options[:connection_options] || {} @@ -371,7 +373,8 @@ module Fog :openstack_tenant => @openstack_tenant, :openstack_service_type => @openstack_service_type, :openstack_service_name => @openstack_service_name, - :openstack_identity_service_type => @openstack_identity_service_type + :openstack_identity_service_type => @openstack_identity_service_type, + :openstack_endpoint_type => @openstack_endpoint_type } if @openstack_auth_uri.path =~ /\/v2.0\//