From 80cf00dffe0365a21df19037fe13e8c82de56909 Mon Sep 17 00:00:00 2001 From: Matthias Bastian Date: Thu, 1 Feb 2018 18:47:48 +0100 Subject: [PATCH] Set OS_INTERFACE and OS_ENDPOINT_TYPE in auth file OSC does not use service-specific environment variables for choosing endpoints. It requires a common OS_INTERFACE variable that is used for --os-interface. OS_ENDPOINT_TYPE is the analog for older service-specific clients and is used for --os-endpoint-type. Change-Id: I5dd8de00e72631d578cf7e0b7028705a5cda1ddb --- manifests/auth_file.pp | 10 ++++++++++ spec/classes/openstack_extras_auth_file_spec.rb | 6 ++++++ templates/openrc.erb | 2 ++ 3 files changed, 18 insertions(+) diff --git a/manifests/auth_file.pp b/manifests/auth_file.pp index 85568d5..46653c1 100644 --- a/manifests/auth_file.pp +++ b/manifests/auth_file.pp @@ -45,6 +45,14 @@ # (optional) Do not use the auth token cache. # Defaults to true. # +# [*os_interface*] +# (optional) The common endpoint to use with OSC +# Defaults to 'public'. +# +# [*os_endpoint_type*] +# (optional) The common endpoint to use with service-specific clients +# Defaults to 'publicURL'. +# # [*cinder_endpoint_type*] # (optional) The Cinder endpoint to use # Defaults to 'publicURL'. @@ -103,6 +111,8 @@ class openstack_extras::auth_file( $project_domain = 'default', $user_domain = 'default', $auth_type = undef, + $os_interface = 'public', + $os_endpoint_type = 'publicURL', $cinder_endpoint_type = 'publicURL', $glance_endpoint_type = 'publicURL', $keystone_endpoint_type = 'publicURL', diff --git a/spec/classes/openstack_extras_auth_file_spec.rb b/spec/classes/openstack_extras_auth_file_spec.rb index 57ab2b4..3cb0480 100644 --- a/spec/classes/openstack_extras_auth_file_spec.rb +++ b/spec/classes/openstack_extras_auth_file_spec.rb @@ -19,6 +19,8 @@ describe 'openstack_extras::auth_file' do 'export OS_REGION_NAME=\'RegionOne\'', 'export OS_PROJECT_DOMAIN_NAME=\'default\'', 'export OS_USER_DOMAIN_NAME=\'default\'', + 'export OS_INTERFACE=\'public\'', + 'export OS_ENDPOINT_TYPE=\'publicURL\'', 'export CINDER_ENDPOINT_TYPE=\'publicURL\'', 'export GLANCE_ENDPOINT_TYPE=\'publicURL\'', 'export KEYSTONE_ENDPOINT_TYPE=\'publicURL\'', @@ -42,6 +44,8 @@ describe 'openstack_extras::auth_file' do :project_name => 'myproject', :region_name => 'myregion', :use_no_cache => 'false', + :os_interface => 'internal', + :os_endpoint_type => 'internalURL', :cinder_endpoint_type => 'internalURL', :glance_endpoint_type => 'internalURL', :keystone_endpoint_type => 'internalURL', @@ -68,6 +72,8 @@ describe 'openstack_extras::auth_file' do 'export OS_REGION_NAME=\'myregion\'', 'export OS_PROJECT_DOMAIN_NAME=\'anotherdomain\'', 'export OS_USER_DOMAIN_NAME=\'anotherdomain\'', + 'export OS_INTERFACE=\'internal\'', + 'export OS_ENDPOINT_TYPE=\'internalURL\'', 'export CINDER_ENDPOINT_TYPE=\'internalURL\'', 'export GLANCE_ENDPOINT_TYPE=\'internalURL\'', 'export KEYSTONE_ENDPOINT_TYPE=\'internalURL\'', diff --git a/templates/openrc.erb b/templates/openrc.erb index 66d75da..3a9b508 100644 --- a/templates/openrc.erb +++ b/templates/openrc.erb @@ -24,6 +24,8 @@ export OS_USER_DOMAIN_NAME='<%= @user_domain %>' <% if @auth_type -%> export OS_AUTH_TYPE='<%= @auth_type %>' <% end -%> +export OS_INTERFACE='<%= @os_interface %>' +export OS_ENDPOINT_TYPE='<%= @os_endpoint_type %>' export CINDER_ENDPOINT_TYPE='<%= @cinder_endpoint_type %>' export GLANCE_ENDPOINT_TYPE='<%= @glance_endpoint_type %>' export KEYSTONE_ENDPOINT_TYPE='<%= @keystone_endpoint_type %>'