Add project_name parameter for auth_file

With keystone v3, the term 'tenant' is deprecated in favor of the term
'project'. Clients using the v3 API (including the puppet providers)
will only look for 'project' and not 'tenant'. This patch adds
$project_name as a parameter to openstack_extras::auth_file. It
defaults to undef and only appears in the openrc file if it is being
used. This follows the pattern set by $project_domain and $user_domain,
which will only be set if the user actively chooses to use them. This
doesn't change how $tenant_name is set.

Change-Id: Idc3b938e37b792636ec7c2702bf8429467b78d66
This commit is contained in:
Colleen Murphy 2016-01-29 16:25:02 -08:00
parent bbaf0667ae
commit b21b30b18a
3 changed files with 11 additions and 0 deletions

View File

@ -32,6 +32,11 @@
# (optional) Tenant for this account as defined in keystone
# Defaults to 'openstack'.
#
# [*project_name*]
# (optional) Project for this account as defined in keystone
# Use instead of tenant_name for when using identity v3.
# Defaults to undef.
#
# [*region_name*]
# (optional) Openstack region to use
# Defaults to 'RegionOne'.
@ -84,6 +89,7 @@ class openstack_extras::auth_file(
$service_endpoint = 'http://127.0.0.1:35357/v2.0/',
$username = 'admin',
$tenant_name = 'openstack',
$project_name = undef,
$region_name = 'RegionOne',
$use_no_cache = true,
$project_domain = false,

View File

@ -36,6 +36,7 @@ describe 'openstack_extras::auth_file' do
:service_endpoint => 'http://127.0.0.2:35357/v2.0/',
:username => 'myuser',
:tenant_name => 'mytenant',
:project_name => 'myproject',
:region_name => 'myregion',
:use_no_cache => 'false',
:cinder_endpoint_type => 'internalURL',
@ -55,6 +56,7 @@ describe 'openstack_extras::auth_file' do
'export OS_SERVICE_ENDPOINT=\'http://127.0.0.2:35357/v2.0/\'',
'export OS_NO_CACHE=\'false\'',
'export OS_TENANT_NAME=\'mytenant\'',
'export OS_PROJECT_NAME=\'myproject\'',
'export OS_USERNAME=\'myuser\'',
'export OS_PASSWORD=\'admin\'',
'export OS_AUTH_URL=\'http://127.0.0.2:5000/v2.0/\'',

View File

@ -5,6 +5,9 @@ export OS_SERVICE_ENDPOINT='<%= @service_endpoint %>'
<% end -%>
export OS_NO_CACHE='<%= @use_no_cache %>'
export OS_TENANT_NAME='<%= @tenant_name %>'
<% if @project_name -%>
export OS_PROJECT_NAME='<%= @project_name %>'
<% end -%>
export OS_USERNAME='<%= @username %>'
export OS_PASSWORD='<%= @password.gsub(/'/){ %q(\') } %>'
export OS_AUTH_URL='<%= @auth_url %>'