Merge "Remove deprecated parameters for keystone::auth"

This commit is contained in:
Jenkins 2017-08-26 12:46:06 +00:00 committed by Gerrit Code Review
commit d3961785fe
3 changed files with 12 additions and 212 deletions

View File

@ -87,67 +87,6 @@
# (optional) The endpoint's internal url. (Defaults to 'http://127.0.0.1:8080')
# This url should *not* contain any trailing '/'.
#
# [*endpoint_prefix*]
# (optional) DEPRECATED: Use public_url, internal_url and admin_url instead.
# The prefix endpoint, used for endpoint URL. (Defaults to 'AUTH')
# Setting this parameter overrides public_url, internal_url and admin_url parameters.
#
# [*port*]
# (optional) DEPRECATED: Use public_url(_s3), internal_url(_s3) and admin_url(_s3) instead.
# Default port for endpoints. (Defaults to 8080)
# Setting this parameter overrides public_url(_s3), internal_url(_s3) and admin_url(_s3) parameters.
#
# [*public_port*]
# (optional) DEPRECATED: Use public_url(_s3) instead.
# Default port for endpoints. (Defaults to $port)
# Setting this parameter overrides public_url(_s3) parameter.
#
# [*public_protocol*]
# (optional) DEPRECATED: Use public_url instead.
# Protocol for public endpoint. (Defaults to 'http')
# Setting this parameter overrides public_url parameter.
#
# [*public_address*]
# (optional) DEPRECATED: Use public_url instead.
# Public address for endpoint. (Defaults to '127.0.0.1')
# Setting this parameter overrides public_url parameter.
#
# [*internal_protocol*]
# (optional) DEPRECATED: Use internal_url instead.
# Protocol for internal endpoint. (Defaults to 'http')
# Setting this parameter overrides internal_url parameter.
#
# [*internal_address*]
# (optional) DEPRECATED: Use internal_url instead.
# Internal address for endpoint. (Defaults to '127.0.0.1')
# Setting this parameter overrides internal_url parameter.
#
# [*admin_protocol*]
# (optional) DEPRECATED: Use admin_url instead.
# Protocol for admin endpoint. (Defaults to 'http')
# Setting this parameter overrides admin_url parameter.
#
# [*admin_address*]
# (optional) DEPRECATED: Use admin_url instead.
# Admin address for endpoint. (Defaults to '127.0.0.1')
# Setting this parameter overrides admin_url parameter.
#
# === Deprecation notes
#
# If any value is provided for public_protocol, public_address or port parameters,
# public_url will be completely ignored. The same applies for internal and admin parameters.
#
# === Examples
#
# class { 'swift::keystone::auth':
# public_url => 'https://10.0.0.10:8080/v1/AUTH_%(tenant_id)s',
# internal_url => 'https://10.0.0.11:8080/v1/AUTH_%(tenant_id)s',
# admin_url => 'https://10.0.0.11:8080',
# public_url_s3 => 'https://10.0.0.10:8080',
# internal_url_s3 => 'https://10.0.0.11:8080',
# admin_url_s3 => 'https://10.0.0.11:8080',
# }
#
class swift::keystone::auth(
$auth_name = 'swift',
$password = 'swift_password',
@ -169,113 +108,10 @@ class swift::keystone::auth(
$public_url_s3 = 'http://127.0.0.1:8080',
$admin_url_s3 = 'http://127.0.0.1:8080',
$internal_url_s3 = 'http://127.0.0.1:8080',
# DEPRECATED PARAMETERS
$endpoint_prefix = undef,
$port = undef,
$public_port = undef,
$public_protocol = undef,
$public_address = undef,
$internal_protocol = undef,
$internal_address = undef,
$admin_protocol = undef,
$admin_address = undef,
) {
include ::swift::deps
if $endpoint_prefix {
warning('The endpoint_prefix parameter is deprecated, use public_url, internal_url and admin_url instead.')
}
if $port {
warning("The port parameter is deprecated, use public_url, internal_url, admin_url, \
public_url_s3, internal_url_s3 and admin_url_s3 instead.")
}
if $public_port {
warning('The public_port parameter is deprecated, use public_url and public_url_s3 instead.')
}
if $public_protocol {
warning('The public_protocol parameter is deprecated, use public_url and public_url_s3 instead.')
}
if $internal_protocol {
warning('The internal_protocol parameter is deprecated, use internal_url and internal_url_s3 instead.')
}
if $admin_protocol {
warning('The admin_protocol parameter is deprecated, use admin_url and admin_url_s3 instead.')
}
if $public_address {
warning('The public_address parameter is deprecated, use public_url and public_url_s3 instead.')
}
if $internal_address {
warning('The internal_address parameter is deprecated, use internal_url and internal_url_s3 instead.')
}
if $admin_address {
warning('The admin_address parameter is deprecated, use admin_url and admin_url_s3 instead.')
}
if ($public_protocol or $public_address or $port or $public_port or $endpoint_prefix) {
$public_url_real = sprintf('%s://%s:%s/v1/%s_%%(tenant_id)s',
pick($public_protocol, 'http'),
pick($public_address, '127.0.0.1'),
pick($public_port, $port, '8080'),
pick($endpoint_prefix, 'AUTH'))
} else {
$public_url_real = $public_url
}
if ($admin_protocol or $admin_address or $public_address or $port) {
$admin_url_real = sprintf('%s://%s:%s',
pick($admin_protocol, 'http'),
pick($admin_address, $public_address, '127.0.0.1'),
pick($port, '8080'))
} else {
$admin_url_real = $admin_url
}
if ($internal_protocol or $internal_address or $public_address or $port or $endpoint_prefix) {
$internal_url_real = sprintf('%s://%s:%s/v1/%s_%%(tenant_id)s',
pick($internal_protocol, 'http'),
pick($internal_address, $public_address, '127.0.0.1'),
pick($port, '8080'),
pick($endpoint_prefix, 'AUTH'))
} else {
$internal_url_real = $internal_url
}
if ($public_protocol or $public_address or $port or $public_port) {
$public_url_s3_real = sprintf('%s://%s:%s',
pick($public_protocol, 'http'),
pick($public_address, '127.0.0.1'),
pick($public_port, $port, '8080'))
} else {
$public_url_s3_real = $public_url_s3
}
if ($admin_protocol or $admin_address or $public_address or $port) {
$admin_url_s3_real = sprintf('%s://%s:%s',
pick($admin_protocol, 'http'),
pick($admin_address, $public_address, '127.0.0.1'),
pick($port, '8080'))
} else {
$admin_url_s3_real = $admin_url_s3
}
if ($internal_protocol or $internal_address or $public_address or $port) {
$internal_url_s3_real = sprintf('%s://%s:%s',
pick($internal_protocol, 'http'),
pick($internal_address, $public_address, '127.0.0.1'),
pick($port, '8080'))
} else {
$internal_url_s3_real = $internal_url_s3
}
if $service_name == $service_name_s3 {
fail('swift::keystone::auth parameters service_name and service_name_s3 must be different.')
}
@ -301,9 +137,9 @@ public_url_s3, internal_url_s3 and admin_url_s3 instead.")
password => $password,
email => $email,
tenant => $tenant,
public_url => $public_url_real,
admin_url => $admin_url_real,
internal_url => $internal_url_real,
public_url => $public_url,
admin_url => $admin_url,
internal_url => $internal_url,
}
keystone::resource::service_identity { 'swift_s3':
@ -315,9 +151,9 @@ public_url_s3, internal_url_s3 and admin_url_s3 instead.")
service_type => 's3',
service_description => $service_description_s3,
region => $region,
public_url => $public_url_s3_real,
admin_url => $admin_url_s3_real,
internal_url => $internal_url_s3_real,
public_url => $public_url_s3,
admin_url => $admin_url_s3,
internal_url => $internal_url_s3,
}
if $operator_roles {

View File

@ -0,0 +1,6 @@
---
other:
- Remove deprecated parameters for keystone::auth, including
endpoint_prefix, port, public_protocol, public_address, public_port,
internal_protocol, internal_address, admin_protocol, admin_address.
Use the new parameters public_url, admin_url and internal_url instead.

View File

@ -10,7 +10,6 @@ describe 'swift::keystone::auth' do
{
:auth_name => 'swift',
:password => 'swift_password',
:port => '8080',
:tenant => 'services',
:email => 'swift@localhost',
:region => 'RegionOne',
@ -91,47 +90,6 @@ describe 'swift::keystone::auth' do
end
end
context 'with deprecated endpoint parameters' do
before do
params.merge!({
:auth_name => 'object_store',
:password => 'passw0rd',
:port => '443',
:tenant => 'admin',
:email => 'object_store@localhost',
:region => 'RegionTwo',
:operator_roles => ['admin', 'SwiftOperator', 'Gopher'],
:public_protocol => 'https',
:public_address => 'public.example.org',
:public_port => '443',
:admin_protocol => 'https',
:admin_address => 'admin.example.org',
:internal_protocol => 'https',
:internal_address => 'internal.example.org',
:endpoint_prefix => 'KEY_AUTH',
:service_name => 'swift',
:service_name_s3 => 'swift_s3'
})
end
let :p do
default_params.merge( params )
end
it { is_expected.to contain_keystone_endpoint("#{p[:region]}/#{p[:service_name]}::object-store").with(
:ensure => 'present',
:public_url => "#{p[:public_protocol]}://#{p[:public_address]}:#{p[:public_port]}/v1/#{p[:endpoint_prefix]}_%(tenant_id)s",
:admin_url => "#{p[:admin_protocol]}://#{p[:admin_address]}:#{p[:port]}",
:internal_url => "#{p[:internal_protocol]}://#{p[:internal_address]}:#{p[:port]}/v1/#{p[:endpoint_prefix]}_%(tenant_id)s"
)}
it { is_expected.to contain_keystone_endpoint("#{p[:region]}/#{p[:service_name_s3]}::s3").with(
:ensure => 'present',
:public_url => "#{p[:public_protocol]}://#{p[:public_address]}:#{p[:port]}",
:admin_url => "#{p[:admin_protocol]}://#{p[:admin_address]}:#{p[:port]}",
:internal_url => "#{p[:internal_protocol]}://#{p[:internal_address]}:#{p[:port]}"
)}
end
end
shared_examples_for 'keystone auth configuration' do