Make providers use auth_url for authentication

When reading credentials from the configuration's keystone_authtoken
section www_authenticate_uri was used as URL for Keystone.
As www_authenticate_uri is a public endpoint that is not necessarily
reachable for the Puppet agent, this change uses the more appropriate
auth_url as Keystone URL.

Change-Id: I16145064b8867c64abddf4a12f460464ee2d9c04
This commit is contained in:
Matthias Bastian 2018-08-03 11:35:38 +02:00
parent f9c2235839
commit 642666b15e
2 changed files with 12 additions and 12 deletions

View File

@ -52,7 +52,7 @@ class Puppet::Provider::Cinder < Puppet::Provider::Openstack
end
def self.get_cinder_credentials
auth_keys = ['www_authenticate_uri', 'project_name', 'username',
auth_keys = ['auth_url', 'project_name', 'username',
'password']
conf = cinder_conf
if conf and conf['keystone_authtoken'] and
@ -82,7 +82,7 @@ class Puppet::Provider::Cinder < Puppet::Provider::Openstack
def self.get_auth_endpoint
q = cinder_credentials
"#{q['www_authenticate_uri']}"
"#{q['auth_url']}"
end
def self.auth_endpoint

View File

@ -24,19 +24,19 @@ describe Puppet::Provider::Cinder do
it 'should read conf file with all sections' do
creds_hash = {
'www_authenticate_uri' => 'https://192.168.56.210:5000/v2.0/',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
'project_domain_name' => 'Default',
'user_domain_name' => 'Default',
'auth_url' => 'https://192.168.56.210:5000/v2.0/',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
'project_domain_name' => 'Default',
'user_domain_name' => 'Default',
}
mock = {
'keystone_authtoken' => {
'www_authenticate_uri' => 'https://192.168.56.210:5000/v2.0/',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
'auth_url' => 'https://192.168.56.210:5000/v2.0/',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
}
}
Puppet::Util::IniConfig::File.expects(:new).returns(mock)