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
|
def self.get_neutron_credentials
|
||||||
deprecated_auth_keys = ['admin_tenant_name', 'admin_user', 'admin_password', 'identity_uri']
|
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
|
conf = neutron_conf
|
||||||
if conf and conf['keystone_authtoken'] and
|
if conf and conf['keystone_authtoken'] and
|
||||||
!conf['keystone_authtoken']['password'].nil? and
|
!conf['keystone_authtoken']['password'].nil? and
|
||||||
@ -76,10 +76,10 @@ correctly configured.")
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
authenv = {
|
authenv = {
|
||||||
:OS_AUTH_URL => q['auth_url'],
|
:OS_AUTH_URL => q['auth_url'],
|
||||||
:OS_USERNAME => q['username'],
|
:OS_USERNAME => q['username'],
|
||||||
:OS_TENANT_NAME => q['tenant_name'],
|
:OS_PROJECT_NAME => q['project_name'],
|
||||||
:OS_PASSWORD => q['password']
|
:OS_PASSWORD => q['password']
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
if q.key?('nova_region_name')
|
if q.key?('nova_region_name')
|
||||||
|
@ -52,10 +52,6 @@
|
|||||||
# The password to use for authentication (keystone)
|
# The password to use for authentication (keystone)
|
||||||
# Either password or auth_password is required
|
# Either password or auth_password is required
|
||||||
#
|
#
|
||||||
# [*tenant_name*]
|
|
||||||
# (optional) The tenant of the auth user
|
|
||||||
# Defaults to 'services'
|
|
||||||
#
|
|
||||||
# [*project_domain_id*]
|
# [*project_domain_id*]
|
||||||
# (optional) Auth user project's domain ID
|
# (optional) Auth user project's domain ID
|
||||||
# Defaults to 'Default'
|
# Defaults to 'Default'
|
||||||
@ -252,6 +248,11 @@
|
|||||||
# An authentication plugin to use with an OpenStack Identity server.
|
# An authentication plugin to use with an OpenStack Identity server.
|
||||||
# Defaults to $::os_service_plugin
|
# 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 (
|
class neutron::server (
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$enabled = true,
|
$enabled = true,
|
||||||
@ -263,7 +264,6 @@ class neutron::server (
|
|||||||
$auth_url = 'http://localhost:35357/',
|
$auth_url = 'http://localhost:35357/',
|
||||||
$username = 'neutron',
|
$username = 'neutron',
|
||||||
$password = false,
|
$password = false,
|
||||||
$tenant_name = 'services',
|
|
||||||
$region_name = $::os_service_default,
|
$region_name = $::os_service_default,
|
||||||
$project_domain_id = 'Default',
|
$project_domain_id = 'Default',
|
||||||
$project_name = 'services',
|
$project_name = 'services',
|
||||||
@ -303,6 +303,7 @@ class neutron::server (
|
|||||||
$auth_user = 'neutron',
|
$auth_user = 'neutron',
|
||||||
$identity_uri = 'http://localhost:35357/',
|
$identity_uri = 'http://localhost:35357/',
|
||||||
$auth_plugin = $::os_service_default,
|
$auth_plugin = $::os_service_default,
|
||||||
|
$tenant_name = $::os_service_default,
|
||||||
) inherits ::neutron::params {
|
) inherits ::neutron::params {
|
||||||
|
|
||||||
include ::neutron::db
|
include ::neutron::db
|
||||||
@ -470,14 +471,20 @@ class neutron::server (
|
|||||||
|
|
||||||
} else {
|
} 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 {
|
neutron_config {
|
||||||
'keystone_authtoken/auth_url': value => $auth_url;
|
'keystone_authtoken/auth_url': value => $auth_url;
|
||||||
'keystone_authtoken/tenant_name': value => $tenant_name;
|
|
||||||
'keystone_authtoken/username': value => $username;
|
'keystone_authtoken/username': value => $username;
|
||||||
'keystone_authtoken/password': value => $password, secret => true;
|
'keystone_authtoken/password': value => $password, secret => true;
|
||||||
'keystone_authtoken/region_name': value => $region_name;
|
'keystone_authtoken/region_name': value => $region_name;
|
||||||
'keystone_authtoken/project_domain_id': value => $project_domain_id;
|
'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/user_domain_id': value => $user_domain_id;
|
||||||
'keystone_authtoken/admin_tenant_name': ensure => absent;
|
'keystone_authtoken/admin_tenant_name': ensure => absent;
|
||||||
'keystone_authtoken/admin_user': 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',
|
:keystone_auth_type => 'password',
|
||||||
:project_domain_id => 'Default',
|
:project_domain_id => 'Default',
|
||||||
:project_name => 'services',
|
:project_name => 'services',
|
||||||
:user_domain_id => 'Default',
|
:user_domain_id => 'Default'}
|
||||||
:tenant_name => 'services' }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
let :default_params do
|
let :default_params do
|
||||||
@ -52,7 +51,6 @@ describe 'neutron::server' do
|
|||||||
|
|
||||||
it 'configures authentication middleware' 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/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/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_value(p[:password]);
|
||||||
is_expected.to contain_neutron_config('keystone_authtoken/password').with_secret( true )
|
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/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/identity_uri').with_value('https://foo.bar:5000/');
|
||||||
is_expected.to contain_neutron_config('keystone_authtoken/auth_region').with_value('MyRegion');
|
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/username');
|
||||||
is_expected.not_to contain_neutron_config('keystone_authtoken/password');
|
is_expected.not_to contain_neutron_config('keystone_authtoken/password');
|
||||||
is_expected.not_to contain_neutron_config('keystone_authtoken/auth_url');
|
is_expected.not_to contain_neutron_config('keystone_authtoken/auth_url');
|
||||||
|
@ -11,10 +11,10 @@ describe Puppet::Provider::Neutron do
|
|||||||
|
|
||||||
let :credential_hash do
|
let :credential_hash do
|
||||||
{
|
{
|
||||||
'tenant_name' => 'admin_tenant',
|
'project_name' => 'admin_tenant',
|
||||||
'username' => 'admin',
|
'username' => 'admin',
|
||||||
'password' => 'password',
|
'password' => 'password',
|
||||||
'auth_url' => 'https://192.168.56.210:35357'
|
'auth_url' => 'https://192.168.56.210:35357'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -81,10 +81,10 @@ describe Puppet::Provider::Neutron do
|
|||||||
|
|
||||||
it 'should set auth credentials in the environment' do
|
it 'should set auth credentials in the environment' do
|
||||||
authenv = {
|
authenv = {
|
||||||
:OS_AUTH_URL => credential_hash['auth_url'],
|
:OS_AUTH_URL => credential_hash['auth_url'],
|
||||||
:OS_USERNAME => credential_hash['username'],
|
: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_PASSWORD => credential_hash['password'],
|
||||||
}
|
}
|
||||||
klass.expects(:get_neutron_credentials).with().returns(credential_hash)
|
klass.expects(:get_neutron_credentials).with().returns(credential_hash)
|
||||||
klass.expects(:withenv).with(authenv)
|
klass.expects(:withenv).with(authenv)
|
||||||
@ -106,11 +106,11 @@ describe Puppet::Provider::Neutron do
|
|||||||
|
|
||||||
it 'should set region in the environment if needed' do
|
it 'should set region in the environment if needed' do
|
||||||
authenv = {
|
authenv = {
|
||||||
:OS_AUTH_URL => credential_hash['auth_url'],
|
:OS_AUTH_URL => credential_hash['auth_url'],
|
||||||
:OS_USERNAME => credential_hash['username'],
|
: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_PASSWORD => credential_hash['password'],
|
||||||
:OS_REGION_NAME => 'REGION_NAME',
|
:OS_REGION_NAME => 'REGION_NAME',
|
||||||
}
|
}
|
||||||
|
|
||||||
cred_hash = credential_hash.merge({'region_name' => 'REGION_NAME'})
|
cred_hash = credential_hash.merge({'region_name' => 'REGION_NAME'})
|
||||||
|
Loading…
Reference in New Issue
Block a user