diff --git a/lib/puppet/provider/neutron.rb b/lib/puppet/provider/neutron.rb index 4f0aa0a3f..b95b17585 100644 --- a/lib/puppet/provider/neutron.rb +++ b/lib/puppet/provider/neutron.rb @@ -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 @@ -76,10 +76,10 @@ correctly configured.") } else authenv = { - :OS_AUTH_URL => q['auth_url'], - :OS_USERNAME => q['username'], - :OS_TENANT_NAME => q['tenant_name'], - :OS_PASSWORD => q['password'] + :OS_AUTH_URL => q['auth_url'], + :OS_USERNAME => q['username'], + :OS_PROJECT_NAME => q['project_name'], + :OS_PASSWORD => q['password'] } end if q.key?('nova_region_name') diff --git a/manifests/server.pp b/manifests/server.pp index 116cc6494..7cae2fa7c 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -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; diff --git a/releasenotes/notes/remove_tenant_name-baf2c2864deda6ce.yaml b/releasenotes/notes/remove_tenant_name-baf2c2864deda6ce.yaml new file mode 100644 index 000000000..2dec277cb --- /dev/null +++ b/releasenotes/notes/remove_tenant_name-baf2c2864deda6ce.yaml @@ -0,0 +1,3 @@ +--- +deprecations: + - Deprecate tenant_name option. project_name should be used instead. diff --git a/spec/classes/neutron_server_spec.rb b/spec/classes/neutron_server_spec.rb index 4e78ff4d7..3b5975101 100644 --- a/spec/classes/neutron_server_spec.rb +++ b/spec/classes/neutron_server_spec.rb @@ -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'); diff --git a/spec/unit/provider/neutron_spec.rb b/spec/unit/provider/neutron_spec.rb index 946638a50..75f0f51aa 100644 --- a/spec/unit/provider/neutron_spec.rb +++ b/spec/unit/provider/neutron_spec.rb @@ -11,10 +11,10 @@ describe Puppet::Provider::Neutron do let :credential_hash do { - 'tenant_name' => 'admin_tenant', - 'username' => 'admin', - 'password' => 'password', - 'auth_url' => 'https://192.168.56.210:35357' + 'project_name' => 'admin_tenant', + 'username' => 'admin', + 'password' => 'password', + 'auth_url' => 'https://192.168.56.210:35357' } end @@ -81,10 +81,10 @@ describe Puppet::Provider::Neutron do it 'should set auth credentials in the environment' do authenv = { - :OS_AUTH_URL => credential_hash['auth_url'], - :OS_USERNAME => credential_hash['username'], - :OS_TENANT_NAME => credential_hash['tenant_name'], - :OS_PASSWORD => credential_hash['password'], + :OS_AUTH_URL => credential_hash['auth_url'], + :OS_USERNAME => credential_hash['username'], + :OS_PROJECT_NAME => credential_hash['project_name'], + :OS_PASSWORD => credential_hash['password'], } klass.expects(:get_neutron_credentials).with().returns(credential_hash) klass.expects(:withenv).with(authenv) @@ -106,11 +106,11 @@ describe Puppet::Provider::Neutron do it 'should set region in the environment if needed' do authenv = { - :OS_AUTH_URL => credential_hash['auth_url'], - :OS_USERNAME => credential_hash['username'], - :OS_TENANT_NAME => credential_hash['tenant_name'], - :OS_PASSWORD => credential_hash['password'], - :OS_REGION_NAME => 'REGION_NAME', + :OS_AUTH_URL => credential_hash['auth_url'], + :OS_USERNAME => credential_hash['username'], + :OS_PROJECT_NAME => credential_hash['project_name'], + :OS_PASSWORD => credential_hash['password'], + :OS_REGION_NAME => 'REGION_NAME', } cred_hash = credential_hash.merge({'region_name' => 'REGION_NAME'})