Switch neutron auth provider to keystone v3

Until neutron auth provider has been implicitely using
keystone v2.0 by not declaring DOMAIN variables. Now
Now, api v2.0 is being deprecated and we need to use
API v3.

Change-Id: I5cd9ce7d4ad7c8c723aee9abd98495c979265b48
This commit is contained in:
Alfredo Moralejo 2017-10-04 15:44:15 +02:00
parent 299bc16350
commit ade98626f7
3 changed files with 29 additions and 17 deletions

View File

@ -114,10 +114,12 @@ class Puppet::Provider::Neutron < Puppet::Provider::Openstack
def self.auth_neutron(*args)
q = neutron_credentials
authenv = {
:OS_AUTH_URL => self.auth_endpoint,
:OS_USERNAME => q['username'],
:OS_PROJECT_NAME => q['project_name'],
:OS_PASSWORD => q['password']
:OS_AUTH_URL => self.auth_endpoint,
:OS_USERNAME => q['username'],
:OS_PROJECT_NAME => q['project_name'],
:OS_PASSWORD => q['password'],
:OS_PROJECT_DOMAIN_NAME => q['project_domain_name'],
:OS_USER_DOMAIN_NAME => q['user_domain_name']
}
if q.key?('region_name')
authenv[:OS_REGION_NAME] = q['region_name']

View File

@ -0,0 +1,4 @@
---
features:
- |
neutron auth provider has been switch to use keystone API v3.

View File

@ -11,10 +11,12 @@ describe Puppet::Provider::Neutron do
let :credential_hash do
{
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
'auth_uri' => 'https://192.168.56.210:35357/v2.0/',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
'auth_uri' => 'https://192.168.56.210:35357/v2.0/',
'project_domain_name' => 'Default',
'user_domain_name' => 'Default',
}
end
@ -63,10 +65,12 @@ describe Puppet::Provider::Neutron do
it 'should set auth credentials in the environment' do
authenv = {
:OS_AUTH_URL => credential_hash['auth_uri'],
:OS_USERNAME => credential_hash['username'],
:OS_PROJECT_NAME => credential_hash['project_name'],
:OS_PASSWORD => credential_hash['password'],
:OS_AUTH_URL => credential_hash['auth_uri'],
:OS_USERNAME => credential_hash['username'],
:OS_PROJECT_NAME => credential_hash['project_name'],
:OS_PASSWORD => credential_hash['password'],
:OS_PROJECT_DOMAIN_NAME => credential_hash['project_domain_name'],
:OS_USER_DOMAIN_NAME => credential_hash['user_domain_name'],
}
klass.expects(:get_neutron_credentials).with().returns(credential_hash)
klass.expects(:withenv).with(authenv)
@ -75,11 +79,13 @@ describe Puppet::Provider::Neutron do
it 'should set region in the environment if needed' do
authenv = {
:OS_AUTH_URL => credential_hash['auth_uri'],
:OS_USERNAME => credential_hash['username'],
:OS_PROJECT_NAME => credential_hash['project_name'],
:OS_PASSWORD => credential_hash['password'],
:OS_REGION_NAME => 'REGION_NAME',
:OS_AUTH_URL => credential_hash['auth_uri'],
:OS_USERNAME => credential_hash['username'],
:OS_PROJECT_NAME => credential_hash['project_name'],
:OS_PASSWORD => credential_hash['password'],
:OS_REGION_NAME => 'REGION_NAME',
:OS_PROJECT_DOMAIN_NAME => credential_hash['project_domain_name'],
:OS_USER_DOMAIN_NAME => credential_hash['user_domain_name'],
}
cred_hash = credential_hash.merge({'region_name' => 'REGION_NAME'})