From 4e3341f58988bf938b409cc35a97b8ba57d87a07 Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Tue, 3 Apr 2018 16:55:04 +0800 Subject: [PATCH] Deprecate auth_uri option Option auth_uri from group keystone_authtoken is deprecated[1]. Use option www_authenticate_uri from group keystone_authtoken. [1]https://review.openstack.org/#/c/508522/ Change-Id: If7049561c6a9e94fc5074112db9597cd8cb6996e Depends-On: I4c82a63baabd6b9304b302c97cd751a0103d8316 Depends-On: I0dd36ef1f1f5dcdc57413736ecb8f2555712c36d Closes-Bug: #1759098 --- lib/puppet/provider/trove.rb | 4 ++-- manifests/api.pp | 4 +++- manifests/keystone/authtoken.pp | 19 ++++++++++++++++--- ...e_auth_uri_parameter-87ffc735509a6e7c.yaml | 4 ++++ spec/classes/trove_keystone_authtoken_spec.rb | 6 +++--- 5 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 releasenotes/notes/deprecate_auth_uri_parameter-87ffc735509a6e7c.yaml diff --git a/lib/puppet/provider/trove.rb b/lib/puppet/provider/trove.rb index 9a195053..3adb8a09 100644 --- a/lib/puppet/provider/trove.rb +++ b/lib/puppet/provider/trove.rb @@ -26,7 +26,7 @@ class Puppet::Provider::Trove < Puppet::Provider end def self.get_trove_credentials - auth_keys = ['auth_uri', 'project_name', 'username', 'password', + auth_keys = ['www_authenticate_uri', 'project_name', 'username', 'password', 'project_domain_name', 'user_domain_name'] conf = trove_conf if conf and conf['keystone_authtoken'] and @@ -54,7 +54,7 @@ correctly configured.") def self.auth_trove(*args) q = trove_credentials authenv = { - :OS_AUTH_URL => q['auth_uri'], + :OS_AUTH_URL => q['www_authenticate_uri'], :OS_USERNAME => q['username'], :OS_PROJECT_NAME => q['project_name'], :OS_PASSWORD => q['password'], diff --git a/manifests/api.pp b/manifests/api.pp index 018c2850..bab7841d 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -188,7 +188,9 @@ class trove::api( if $auth_strategy == 'keystone' { include ::trove::keystone::authtoken - $trove_auth_url = "${regsubst($::trove::keystone::authtoken::auth_uri, '(\/v3$|\/v2.0$|\/$)', '')}/v3" + # TODO(tobasco): Remove pick when deprecated auth_url is removed and only use www_authenticate_url + $trove_auth_url_pick = pick($::trove::keystone::authtoken::auth_uri, $::trove::keystone::authtoken::www_authenticate_uri) + $trove_auth_url = "${regsubst($trove_auth_url_pick, '(\/v3$|\/v2.0$|\/$)', '')}/v3" trove_config { 'DEFAULT/trove_auth_url' : value => $trove_auth_url; } diff --git a/manifests/keystone/authtoken.pp b/manifests/keystone/authtoken.pp index 2f12eeec..5763aa91 100644 --- a/manifests/keystone/authtoken.pp +++ b/manifests/keystone/authtoken.pp @@ -42,7 +42,7 @@ # (Optional) Authentication type to load # Defaults to 'password' # -# [*auth_uri*] +# [*www_authenticate_uri*] # (Optional) Complete public Identity API endpoint. # Defaults to 'http://localhost:5000'. # @@ -183,6 +183,12 @@ # (in seconds). Set to -1 to disable caching completely. Integer value # Defaults to $::os_service_default. # +# DEPRECATED PARAMETERS +# +# [*auth_uri*] +# (Optional) Complete public Identity API endpoint. +# Defaults to undef +# class trove::keystone::authtoken( $username = 'trove', $password = $::os_service_default, @@ -193,7 +199,7 @@ class trove::keystone::authtoken( $insecure = $::os_service_default, $auth_section = $::os_service_default, $auth_type = 'password', - $auth_uri = 'http://localhost:5000', + $www_authenticate_uri = 'http://localhost:5000', $auth_version = $::os_service_default, $cache = $::os_service_default, $cafile = $::os_service_default, @@ -218,6 +224,8 @@ class trove::keystone::authtoken( $manage_memcache_package = false, $region_name = $::os_service_default, $token_cache_time = $::os_service_default, + # DEPRECATED PARAMETERS + $auth_uri = undef, ) { include ::trove::deps @@ -226,12 +234,17 @@ class trove::keystone::authtoken( fail('Please set password for trove service user') } + if $auth_uri { + warning('The auth_uri parameter is deprecated. Please use www_authenticate_uri instead.') + } + $www_authenticate_uri_real = pick($auth_uri, $www_authenticate_uri) + keystone::resource::authtoken { 'trove_config': username => $username, password => $password, project_name => $project_name, auth_url => $auth_url, - auth_uri => $auth_uri, + www_authenticate_uri => $www_authenticate_uri_real, auth_version => $auth_version, auth_type => $auth_type, auth_section => $auth_section, diff --git a/releasenotes/notes/deprecate_auth_uri_parameter-87ffc735509a6e7c.yaml b/releasenotes/notes/deprecate_auth_uri_parameter-87ffc735509a6e7c.yaml new file mode 100644 index 00000000..86d56c01 --- /dev/null +++ b/releasenotes/notes/deprecate_auth_uri_parameter-87ffc735509a6e7c.yaml @@ -0,0 +1,4 @@ +--- +deprecations: + - auth_uri is deprecated and will be removed in a future release. + Please use www_authenticate_uri instead. diff --git a/spec/classes/trove_keystone_authtoken_spec.rb b/spec/classes/trove_keystone_authtoken_spec.rb index c73c5cb3..fde2e495 100644 --- a/spec/classes/trove_keystone_authtoken_spec.rb +++ b/spec/classes/trove_keystone_authtoken_spec.rb @@ -20,7 +20,7 @@ describe 'trove::keystone::authtoken' do is_expected.to contain_trove_config('keystone_authtoken/insecure').with_value('') is_expected.to contain_trove_config('keystone_authtoken/auth_section').with_value('') is_expected.to contain_trove_config('keystone_authtoken/auth_type').with_value('password') - is_expected.to contain_trove_config('keystone_authtoken/auth_uri').with_value('http://localhost:5000') + is_expected.to contain_trove_config('keystone_authtoken/www_authenticate_uri').with_value('http://localhost:5000') is_expected.to contain_trove_config('keystone_authtoken/auth_version').with_value('') is_expected.to contain_trove_config('keystone_authtoken/cache').with_value('') is_expected.to contain_trove_config('keystone_authtoken/cafile').with_value('') @@ -50,7 +50,7 @@ describe 'trove::keystone::authtoken' do context 'when overriding parameters' do before do params.merge!({ - :auth_uri => 'https://10.0.0.1:9999/', + :www_authenticate_uri => 'https://10.0.0.1:9999/', :username => 'myuser', :password => 'mypasswd', :auth_url => 'http://:127.0.0.1:35357', @@ -88,7 +88,7 @@ describe 'trove::keystone::authtoken' do end it 'configure keystone_authtoken' do - is_expected.to contain_trove_config('keystone_authtoken/auth_uri').with_value('https://10.0.0.1:9999/') + is_expected.to contain_trove_config('keystone_authtoken/www_authenticate_uri').with_value('https://10.0.0.1:9999/') is_expected.to contain_trove_config('keystone_authtoken/username').with_value(params[:username]) is_expected.to contain_trove_config('keystone_authtoken/password').with_value(params[:password]).with_secret(true) is_expected.to contain_trove_config('keystone_authtoken/auth_url').with_value(params[:auth_url])