Fix useless tenant_name parameter being set
tenant_name parameter is not being used anymore. Add deprecation warning and copy its value to project_name. Closes-bug: #1560850 Change-Id: Ic168811636608e5f951e0989a042909fbe6ba7b9
This commit is contained in:
parent
7baa3858af
commit
dd6fec3065
@ -27,7 +27,7 @@ class Puppet::Provider::Neutron < Puppet::Provider
|
||||
|
||||
def self.get_neutron_credentials
|
||||
deprecated_auth_keys = ['admin_tenant_name', 'admin_user', 'admin_password', 'identity_uri']
|
||||
auth_keys = ['tenant_name', 'username', 'password', 'auth_url']
|
||||
auth_keys = ['project_name', 'username', 'password', 'auth_url']
|
||||
conf = neutron_conf
|
||||
if conf and conf['keystone_authtoken'] and
|
||||
!conf['keystone_authtoken']['password'].nil? and
|
||||
@ -78,7 +78,7 @@ correctly configured.")
|
||||
authenv = {
|
||||
:OS_AUTH_URL => q['auth_url'],
|
||||
:OS_USERNAME => q['username'],
|
||||
:OS_TENANT_NAME => q['tenant_name'],
|
||||
:OS_PROJECT_NAME => q['project_name'],
|
||||
:OS_PASSWORD => q['password']
|
||||
}
|
||||
end
|
||||
|
@ -52,10 +52,6 @@
|
||||
# The password to use for authentication (keystone)
|
||||
# Either password or auth_password is required
|
||||
#
|
||||
# [*tenant_name*]
|
||||
# (optional) The tenant of the auth user
|
||||
# Defaults to 'services'
|
||||
#
|
||||
# [*project_domain_id*]
|
||||
# (optional) Auth user project's domain ID
|
||||
# Defaults to 'Default'
|
||||
@ -252,6 +248,11 @@
|
||||
# An authentication plugin to use with an OpenStack Identity server.
|
||||
# Defaults to $::os_service_plugin
|
||||
#
|
||||
# [*tenant_name*]
|
||||
# Deprecated. project_name should be used instead
|
||||
# The tenant of the auth user
|
||||
# Defaults to $::os_service_plugin
|
||||
#
|
||||
class neutron::server (
|
||||
$package_ensure = 'present',
|
||||
$enabled = true,
|
||||
@ -263,7 +264,6 @@ class neutron::server (
|
||||
$auth_url = 'http://localhost:35357/',
|
||||
$username = 'neutron',
|
||||
$password = false,
|
||||
$tenant_name = 'services',
|
||||
$region_name = $::os_service_default,
|
||||
$project_domain_id = 'Default',
|
||||
$project_name = 'services',
|
||||
@ -303,6 +303,7 @@ class neutron::server (
|
||||
$auth_user = 'neutron',
|
||||
$identity_uri = 'http://localhost:35357/',
|
||||
$auth_plugin = $::os_service_default,
|
||||
$tenant_name = $::os_service_default,
|
||||
) inherits ::neutron::params {
|
||||
|
||||
include ::neutron::db
|
||||
@ -470,14 +471,20 @@ class neutron::server (
|
||||
|
||||
} else {
|
||||
|
||||
if !is_service_default($tenant_name) {
|
||||
warning('tenant_name configuration option is deprecated in favor of project_name')
|
||||
$project_name_real = $tenant_name
|
||||
} else {
|
||||
$project_name_real = $project_name
|
||||
}
|
||||
|
||||
neutron_config {
|
||||
'keystone_authtoken/auth_url': value => $auth_url;
|
||||
'keystone_authtoken/tenant_name': value => $tenant_name;
|
||||
'keystone_authtoken/username': value => $username;
|
||||
'keystone_authtoken/password': value => $password, secret => true;
|
||||
'keystone_authtoken/region_name': value => $region_name;
|
||||
'keystone_authtoken/project_domain_id': value => $project_domain_id;
|
||||
'keystone_authtoken/project_name': value => $project_name;
|
||||
'keystone_authtoken/project_name': value => $project_name_real;
|
||||
'keystone_authtoken/user_domain_id': value => $user_domain_id;
|
||||
'keystone_authtoken/admin_tenant_name': ensure => absent;
|
||||
'keystone_authtoken/admin_user': ensure => absent;
|
||||
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
deprecations:
|
||||
- Deprecate tenant_name option. project_name should be used instead.
|
@ -12,8 +12,7 @@ describe 'neutron::server' do
|
||||
:keystone_auth_type => 'password',
|
||||
:project_domain_id => 'Default',
|
||||
:project_name => 'services',
|
||||
:user_domain_id => 'Default',
|
||||
:tenant_name => 'services' }
|
||||
:user_domain_id => 'Default'}
|
||||
end
|
||||
|
||||
let :default_params do
|
||||
@ -52,7 +51,6 @@ describe 'neutron::server' do
|
||||
|
||||
it 'configures authentication middleware' do
|
||||
is_expected.to contain_neutron_config('keystone_authtoken/auth_type').with_value(p[:keystone_auth_type]);
|
||||
is_expected.to contain_neutron_config('keystone_authtoken/tenant_name').with_value(p[:tenant_name]);
|
||||
is_expected.to contain_neutron_config('keystone_authtoken/username').with_value(p[:username]);
|
||||
is_expected.to contain_neutron_config('keystone_authtoken/password').with_value(p[:password]);
|
||||
is_expected.to contain_neutron_config('keystone_authtoken/password').with_secret( true )
|
||||
@ -243,7 +241,7 @@ describe 'neutron::server' do
|
||||
is_expected.to contain_neutron_config('keystone_authtoken/admin_password').with_secret( true )
|
||||
is_expected.to contain_neutron_config('keystone_authtoken/identity_uri').with_value('https://foo.bar:5000/');
|
||||
is_expected.to contain_neutron_config('keystone_authtoken/auth_region').with_value('MyRegion');
|
||||
is_expected.not_to contain_neutron_config('keystone_authtoken/tenant_name');
|
||||
is_expected.not_to contain_neutron_config('keystone_authtoken/project_name');
|
||||
is_expected.not_to contain_neutron_config('keystone_authtoken/username');
|
||||
is_expected.not_to contain_neutron_config('keystone_authtoken/password');
|
||||
is_expected.not_to contain_neutron_config('keystone_authtoken/auth_url');
|
||||
|
@ -11,7 +11,7 @@ describe Puppet::Provider::Neutron do
|
||||
|
||||
let :credential_hash do
|
||||
{
|
||||
'tenant_name' => 'admin_tenant',
|
||||
'project_name' => 'admin_tenant',
|
||||
'username' => 'admin',
|
||||
'password' => 'password',
|
||||
'auth_url' => 'https://192.168.56.210:35357'
|
||||
@ -83,7 +83,7 @@ describe Puppet::Provider::Neutron do
|
||||
authenv = {
|
||||
:OS_AUTH_URL => credential_hash['auth_url'],
|
||||
:OS_USERNAME => credential_hash['username'],
|
||||
:OS_TENANT_NAME => credential_hash['tenant_name'],
|
||||
:OS_PROJECT_NAME => credential_hash['project_name'],
|
||||
:OS_PASSWORD => credential_hash['password'],
|
||||
}
|
||||
klass.expects(:get_neutron_credentials).with().returns(credential_hash)
|
||||
@ -108,7 +108,7 @@ describe Puppet::Provider::Neutron do
|
||||
authenv = {
|
||||
:OS_AUTH_URL => credential_hash['auth_url'],
|
||||
:OS_USERNAME => credential_hash['username'],
|
||||
:OS_TENANT_NAME => credential_hash['tenant_name'],
|
||||
:OS_PROJECT_NAME => credential_hash['project_name'],
|
||||
:OS_PASSWORD => credential_hash['password'],
|
||||
:OS_REGION_NAME => 'REGION_NAME',
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user