Undeprecate the $keystone::endpoint::version param

The way this parameter was deprecated is extremely problematic.
Currently, if the user does not set the version, they will receive a
warning telling them that version is deprecated. This is an extremely
poor user experience, because in order to make the warning go away,
they must set the parameter that they are being told not to use. Then
when the parameter is removed after the deprecation period, they will
have broken manifests.

The intention behind deprecating the parameter[1] was to encourage
people to move to unversioned endpoints, which is the future of
keystone v3. Changing the behavior of a parameter is tricky because it
is likely to break people's environments. This patch proposes to
undeprecate the version parameter, because it will continue to be valid
for some time, and instead of issuing a deprecation warning, issue a
warning that the default value is going to change to unversioned in the
next major release. At that point, we can change the default value, and
possibly after that eventually deprecate and phase out the version
parameter.

This patch also clarifies the documentation for the version parameter.
One can't force a parameter to be undef. If set to undef, the parameter
takes the default. In order for users to opt in to unversioned
endpoints, they must set the value to '', not undef, whether using
hiera or not. This is the original intent of the parameter usage as
documented in the commit message[1] that introduced it, it just was not
properly documented.

Note that Puppet 3 handles empty strings and undefined values badly, in
that passing in an empty string to the class will override the default
value (unlike passing in undef), but will also evaluate to undef in
logical expressions. To get around this, we make the default the string
'unset' and check for that rather than undef when checking whether the
user has set the value.

[1] http://git.openstack.org/cgit/openstack/puppet-keystone/commit/?id=9f8ea7d7b4ad33b629b6991837ade04021927280

Change-Id: I44b0c651436e0e6b5a5b97338284d525f38d9d80
(cherry picked from commit 62f3f6e0fc)
This commit is contained in:
Colleen Murphy 2015-12-09 10:24:48 -08:00
parent bee0264356
commit 3c65cfd072
1 changed files with 14 additions and 12 deletions

View File

@ -36,12 +36,10 @@
# If keystone_project_domain is not specified, use $keystone_default_domain
# Defaults to undef
#
# === DEPRECATED
#
# [*version*]
# (optional) API version for endpoint.
# Defaults to 'v2.0'
# If the version is assigned to null value (forced to undef), then it won't be
# Defaults to 'v2.0'. Valid values are 'v2.0', 'v3', or the empty string ''.
# If the version is set to the empty string (''), then it won't be
# used. This is the expected behaviour since Keystone V3 handles API versions
# from the context.
#
@ -61,10 +59,16 @@ class keystone::endpoint (
$user_domain = undef,
$project_domain = undef,
$default_domain = undef,
$version = 'v2.0', # DEPRECATED
$version = 'unset', # defaults to 'v2.0' if unset by user
) {
if empty($version) {
if $version == 'unset' {
warning('In Mitaka, the default value of $keystone::endpoint::version will change to \'\'. To avoid this warning, please set the version parameter.')
$_version = 'v2.0'
} else {
$_version = $version
}
if empty($_version) {
$admin_url_real = $admin_url
$public_url_real = $public_url
@ -76,16 +80,14 @@ class keystone::endpoint (
}
}
else {
warning('The version parameter is deprecated in Liberty.')
$public_url_real = "${public_url}/${version}"
$admin_url_real = "${admin_url}/${version}"
$public_url_real = "${public_url}/${_version}"
$admin_url_real = "${admin_url}/${_version}"
if $internal_url {
$internal_url_real = "${internal_url}/${version}"
$internal_url_real = "${internal_url}/${_version}"
}
else {
$internal_url_real = "${public_url}/${version}"
$internal_url_real = "${public_url}/${_version}"
}
}