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: Ie40e48d0ccd83657de753f92cd8c0018baf8ef8d
This commit is contained in:
Matthias Bastian 2018-08-03 12:01:58 +02:00
parent 387fffa197
commit f505d6fc8b
2 changed files with 9 additions and 9 deletions

View File

@ -29,7 +29,7 @@ class Puppet::Provider::Ironic < Puppet::Provider
end
def self.get_ironic_credentials
auth_keys = ['www_authenticate_uri', 'project_name', 'username', 'password']
auth_keys = ['auth_url', 'project_name', 'username', 'password']
conf = ironic_conf
if conf and conf['keystone_authtoken'] and
auth_keys.all?{|k| !conf['keystone_authtoken'][k].nil?}
@ -67,7 +67,7 @@ correctly configured.")
def self.auth_ironic(*args)
q = ironic_credentials
authenv = {
:OS_AUTH_URL => q['www_authenticate_uri'],
:OS_AUTH_URL => q['auth_url'],
:OS_USERNAME => q['username'],
:OS_PROJECT_NAME => q['project_name'],
:OS_PASSWORD => q['password'],

View File

@ -11,12 +11,12 @@ describe Puppet::Provider::Ironic do
let :credential_hash do
{
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
'www_authenticate_uri' => 'https://192.168.56.210:5000/',
'project_domain_name' => 'admin_tenant_domain',
'user_domain_name' => 'admin_domain',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
'auth_url' => 'https://192.168.56.210:5000/',
'project_domain_name' => 'admin_tenant_domain',
'user_domain_name' => 'admin_domain',
}
end
@ -60,7 +60,7 @@ describe Puppet::Provider::Ironic do
it 'should set auth credentials in the environment' do
authenv = {
:OS_AUTH_URL => credential_hash['www_authenticate_uri'],
:OS_AUTH_URL => credential_hash['auth_url'],
:OS_USERNAME => credential_hash['username'],
:OS_PROJECT_NAME => credential_hash['project_name'],
:OS_PASSWORD => credential_hash['password'],