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: I8b7a88535550831b4390dfcc5025fa3bb34be49c
Depends-On: I4c82a63baabd6b9304b302c97cd751a0103d8316
Closes-Bug: #1759098
This commit is contained in:
ZhongShengping 2018-04-03 16:55:04 +08:00
parent 7623634cb2
commit 6abd7a48a2
6 changed files with 34 additions and 18 deletions

View File

@ -45,7 +45,7 @@ class Puppet::Provider::Sahara < Puppet::Provider::Openstack
end
def self.get_sahara_credentials
auth_keys = ['auth_uri', 'admin_tenant_name', 'admin_user',
auth_keys = ['www_authenticate_uri', 'admin_tenant_name', 'admin_user',
'admin_password']
conf = sahara_conf
if conf and conf['keystone_authtoken'] and
@ -61,7 +61,7 @@ class Puppet::Provider::Sahara < Puppet::Provider::Openstack
def self.get_auth_endpoint
q = sahara_credentials
"#{q['auth_uri']}"
"#{q['www_authenticate_uri']}"
end
def self.auth_endpoint

View File

@ -42,7 +42,7 @@
# (Optional) Authentication type to load
# Defaults to $::os_service_default
#
# [*auth_uri*]
# [*www_authenticate_uri*]
# (Optional) Complete public Identity API endpoint.
# Defaults to 'http://127.0.0.1:5000/'.
#
@ -178,6 +178,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 sahara::keystone::authtoken(
$username = 'sahara',
$password = $::os_service_default,
@ -188,7 +194,7 @@ class sahara::keystone::authtoken(
$insecure = $::os_service_default,
$auth_section = $::os_service_default,
$auth_type = 'password',
$auth_uri = 'http://127.0.0.1:5000/',
$www_authenticate_uri = 'http://127.0.0.1:5000/',
$auth_version = $::os_service_default,
$cache = $::os_service_default,
$cafile = $::os_service_default,
@ -213,16 +219,22 @@ class sahara::keystone::authtoken(
$manage_memcache_package = false,
$region_name = $::os_service_default,
$token_cache_time = $::os_service_default,
# DEPRECATED PARAMETERS
$auth_uri = undef,
) {
include ::sahara::deps
if $auth_uri {
warning('The auth_uri parameter is deprecated. Please use www_authenticate_uri instead.')
}
#NOTE(emilien): Use pick to keep backward compatibility
$username_real = pick($::sahara::admin_user,$username)
$password_real = pick($::sahara::admin_password,$password)
$project_name_real = pick($::sahara::admin_tenant_name,$project_name)
$memcached_servers_real = pick($::sahara::memcached_servers,$memcached_servers)
$auth_uri_real = pick($::sahara::auth_uri,$auth_uri)
$www_authenticate_uri_real = pick($::sahara::auth_uri,$auth_uri,$www_authenticate_uri)
$auth_url_real = pick($::sahara::identity_uri,$auth_url)
keystone::resource::authtoken { 'sahara_config':
@ -230,7 +242,7 @@ class sahara::keystone::authtoken(
password => $password_real,
project_name => $project_name_real,
auth_url => $auth_url_real,
auth_uri => $auth_uri_real,
www_authenticate_uri => $www_authenticate_uri_real,
auth_version => $auth_version,
auth_type => $auth_type,
auth_section => $auth_section,

View File

@ -0,0 +1,4 @@
---
deprecations:
- auth_uri is deprecated and will be removed in a future release.
Please use www_authenticate_uri instead.

View File

@ -33,7 +33,7 @@ describe 'sahara' do
it { is_expected.to contain_sahara_config('DEFAULT/use_floating_ips').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_sahara_config('DEFAULT/host').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_sahara_config('DEFAULT/port').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_sahara_config('keystone_authtoken/auth_uri').with_value('http://127.0.0.1:5000/') }
it { is_expected.to contain_sahara_config('keystone_authtoken/www_authenticate_uri').with_value('http://127.0.0.1:5000/') }
it { is_expected.to contain_sahara_config('DEFAULT/plugins').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_compression').with_value('<SERVICE DEFAULT>') }

View File

@ -20,7 +20,7 @@ describe 'sahara::keystone::authtoken' do
is_expected.to contain_sahara_config('keystone_authtoken/insecure').with_value('<SERVICE DEFAULT>')
is_expected.to contain_sahara_config('keystone_authtoken/auth_section').with_value('<SERVICE DEFAULT>')
is_expected.to contain_sahara_config('keystone_authtoken/auth_type').with_value('password')
is_expected.to contain_sahara_config('keystone_authtoken/auth_uri').with_value('http://127.0.0.1:5000/')
is_expected.to contain_sahara_config('keystone_authtoken/www_authenticate_uri').with_value('http://127.0.0.1:5000/')
is_expected.to contain_sahara_config('keystone_authtoken/auth_version').with_value('<SERVICE DEFAULT>')
is_expected.to contain_sahara_config('keystone_authtoken/cache').with_value('<SERVICE DEFAULT>')
is_expected.to contain_sahara_config('keystone_authtoken/cafile').with_value('<SERVICE DEFAULT>')
@ -50,7 +50,7 @@ describe 'sahara::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',
@ -90,7 +90,7 @@ describe 'sahara::keystone::authtoken' do
end
it 'configure keystone_authtoken' do
is_expected.to contain_sahara_config('keystone_authtoken/auth_uri').with_value('https://10.0.0.1:9999/')
is_expected.to contain_sahara_config('keystone_authtoken/www_authenticate_uri').with_value('https://10.0.0.1:9999/')
is_expected.to contain_sahara_config('keystone_authtoken/username').with_value(params[:username])
is_expected.to contain_sahara_config('keystone_authtoken/password').with_value(params[:password]).with_secret(true)
is_expected.to contain_sahara_config('keystone_authtoken/auth_url').with_value(params[:auth_url])

View File

@ -24,17 +24,17 @@ describe Puppet::Provider::Sahara do
it 'should read conf file with all sections' do
creds_hash = {
'auth_uri' => 'https://192.168.56.210:35357/v2.0/',
'admin_tenant_name' => 'admin_tenant',
'admin_user' => 'admin',
'admin_password' => 'password',
'www_authenticate_uri' => 'https://192.168.56.210:35357/v2.0/',
'admin_tenant_name' => 'admin_tenant',
'admin_user' => 'admin',
'admin_password' => 'password',
}
mock = {
'keystone_authtoken' => {
'auth_uri' => 'https://192.168.56.210:35357/v2.0/',
'admin_tenant_name' => 'admin_tenant',
'admin_user' => 'admin',
'admin_password' => 'password',
'www_authenticate_uri' => 'https://192.168.56.210:35357/v2.0/',
'admin_tenant_name' => 'admin_tenant',
'admin_user' => 'admin',
'admin_password' => 'password',
}
}
Puppet::Util::IniConfig::File.expects(:new).returns(mock)