Merge "Set optional API version-related environment vars"

This commit is contained in:
Zuul 2018-05-01 22:00:47 +00:00 committed by Gerrit Code Review
commit eb8750b7b5
3 changed files with 57 additions and 5 deletions

View File

@ -93,9 +93,29 @@
# (optional) Authentication type to load. # (optional) Authentication type to load.
# Default to undef. # Default to undef.
# #
# [*compute_api_version*]
# (optional) Compute API version to use.
# Defaults to undef.
#
# [*network_api_version*]
# (optional) Network API version to use.
# Defaults to undef.
#
# [*image_api_version*]
# (optional) Image API version to use.
# Defaults to undef.
#
# [*volume_api_version*]
# (optional) Volume API version to use.
# Defaults to undef.
#
# [*identity_api_version*] # [*identity_api_version*]
# (optional) Identity API version to use. # (optional) Identity API version to use.
# Defaults to '3'. # Defaults to undef.
#
# [*object_api_version*]
# (optional) Object API version to use.
# Defaults to undef.
# #
class openstack_extras::auth_file( class openstack_extras::auth_file(
@ -120,7 +140,13 @@ class openstack_extras::auth_file(
$neutron_endpoint_type = 'publicURL', $neutron_endpoint_type = 'publicURL',
$auth_strategy = 'keystone', $auth_strategy = 'keystone',
$path = '/root/openrc', $path = '/root/openrc',
$identity_api_version = '3', $compute_api_version = undef,
$network_api_version = undef,
$image_api_version = undef,
$volume_api_version = undef,
$identity_api_version = undef,
$object_api_version = undef,
) { ) {
if ! $password { if ! $password {
fail('You must specify a password for openstack_extras::auth_file') fail('You must specify a password for openstack_extras::auth_file')

View File

@ -26,7 +26,6 @@ describe 'openstack_extras::auth_file' do
'export KEYSTONE_ENDPOINT_TYPE=\'publicURL\'', 'export KEYSTONE_ENDPOINT_TYPE=\'publicURL\'',
'export NOVA_ENDPOINT_TYPE=\'publicURL\'', 'export NOVA_ENDPOINT_TYPE=\'publicURL\'',
'export NEUTRON_ENDPOINT_TYPE=\'publicURL\'', 'export NEUTRON_ENDPOINT_TYPE=\'publicURL\'',
'export OS_IDENTITY_API_VERSION=\'3\'',
]) ])
end end
end end
@ -54,7 +53,12 @@ describe 'openstack_extras::auth_file' do
:auth_strategy => 'no_auth', :auth_strategy => 'no_auth',
:user_domain => 'anotherdomain', :user_domain => 'anotherdomain',
:project_domain => 'anotherdomain', :project_domain => 'anotherdomain',
:identity_api_version => '3.1', :compute_api_version => '2.1',
:network_api_version => '2.0',
:image_api_version => '2',
:volume_api_version => '2',
:identity_api_version => '3',
:object_api_version => '1',
} }
end end
@ -79,7 +83,12 @@ describe 'openstack_extras::auth_file' do
'export KEYSTONE_ENDPOINT_TYPE=\'internalURL\'', 'export KEYSTONE_ENDPOINT_TYPE=\'internalURL\'',
'export NOVA_ENDPOINT_TYPE=\'internalURL\'', 'export NOVA_ENDPOINT_TYPE=\'internalURL\'',
'export NEUTRON_ENDPOINT_TYPE=\'internalURL\'', 'export NEUTRON_ENDPOINT_TYPE=\'internalURL\'',
'export OS_IDENTITY_API_VERSION=\'3.1\'', 'export OS_COMPUTE_API_VERSION=\'2.1\'',
'export OS_NETWORK_API_VERSION=\'2.0\'',
'export OS_IMAGE_API_VERSION=\'2\'',
'export OS_VOLUME_API_VERSION=\'2\'',
'export OS_IDENTITY_API_VERSION=\'3\'',
'export OS_OBJECT_API_VERSION=\'1\'',
]) ])
end end
end end

View File

@ -31,4 +31,21 @@ export GLANCE_ENDPOINT_TYPE='<%= @glance_endpoint_type %>'
export KEYSTONE_ENDPOINT_TYPE='<%= @keystone_endpoint_type %>' export KEYSTONE_ENDPOINT_TYPE='<%= @keystone_endpoint_type %>'
export NOVA_ENDPOINT_TYPE='<%= @nova_endpoint_type %>' export NOVA_ENDPOINT_TYPE='<%= @nova_endpoint_type %>'
export NEUTRON_ENDPOINT_TYPE='<%= @neutron_endpoint_type %>' export NEUTRON_ENDPOINT_TYPE='<%= @neutron_endpoint_type %>'
<% if @compute_api_version -%>
export OS_COMPUTE_API_VERSION='<%= @compute_api_version %>'
<% end -%>
<% if @network_api_version -%>
export OS_NETWORK_API_VERSION='<%= @network_api_version %>'
<% end -%>
<% if @image_api_version -%>
export OS_IMAGE_API_VERSION='<%= @image_api_version %>'
<% end -%>
<% if @volume_api_version -%>
export OS_VOLUME_API_VERSION='<%= @volume_api_version %>'
<% end -%>
<% if @identity_api_version -%>
export OS_IDENTITY_API_VERSION='<%= @identity_api_version %>' export OS_IDENTITY_API_VERSION='<%= @identity_api_version %>'
<% end -%>
<% if @object_api_version -%>
export OS_OBJECT_API_VERSION='<%= @object_api_version %>'
<% end -%>