Make providers use auth_url for authentication

When reading credentials from the configuration's keystone_authtoken
section auth_uri was used as URL for Keystone.
As auth_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: I926effae33eba706897b4861bd1156469500f7af
This commit is contained in:
Matthias Bastian 2018-08-03 12:27:55 +02:00
parent 0a97adf006
commit 4699a63ef0
2 changed files with 8 additions and 8 deletions

View File

@ -37,7 +37,7 @@ class Puppet::Provider::Murano < Puppet::Provider
def self.get_murano_credentials
#needed keys for authentication
auth_keys = ['auth_uri', 'project_name', 'username', 'password']
auth_keys = ['auth_url', 'project_name', 'username', 'password']
conf = murano_conf
if conf and conf['keystone_authtoken'] and
auth_keys.all?{|k| !conf['keystone_authtoken'][k].nil?}
@ -66,7 +66,7 @@ class Puppet::Provider::Murano < Puppet::Provider
def self.auth_murano(*args)
m = murano_credentials
authenv = {
:OS_AUTH_URL => m['auth_uri'],
:OS_AUTH_URL => m['auth_url'],
:OS_USERNAME => m['username'],
:OS_TENANT_NAME => m['project_name'],
:OS_PASSWORD => m['password'],

View File

@ -11,7 +11,7 @@ describe Puppet::Provider::Murano do
let :credential_hash do
{
'auth_uri' => 'https://192.168.56.210:5000',
'auth_url' => 'https://192.168.56.210:5000',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
@ -61,7 +61,7 @@ describe Puppet::Provider::Murano do
it 'should set auth credentials in the environment' do
authenv = {
:OS_AUTH_URL => credential_hash['auth_uri'],
:OS_AUTH_URL => credential_hash['auth_url'],
:OS_USERNAME => credential_hash['username'],
:OS_TENANT_NAME => credential_hash['project_name'],
:OS_PASSWORD => credential_hash['password'],
@ -78,7 +78,7 @@ describe Puppet::Provider::Murano do
it 'should read auth credentials with specified package service' do
mock = {
'keystone_authtoken' => {
'auth_uri' => 'https://192.168.56.210:5000',
'auth_url' => 'https://192.168.56.210:5000',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
@ -88,7 +88,7 @@ describe Puppet::Provider::Murano do
}
}
creds = {
'auth_uri' => 'https://192.168.56.210:5000',
'auth_url' => 'https://192.168.56.210:5000',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
@ -103,7 +103,7 @@ describe Puppet::Provider::Murano do
it 'should set auth env credentials with specified package service' do
creds = {
'auth_uri' => 'https://192.168.56.210:5000',
'auth_url' => 'https://192.168.56.210:5000',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
@ -112,7 +112,7 @@ describe Puppet::Provider::Murano do
'user_domain_name' => 'Default',
}
authenv = {
:OS_AUTH_URL => creds['auth_uri'],
:OS_AUTH_URL => creds['auth_url'],
:OS_USERNAME => creds['username'],
:OS_TENANT_NAME => creds['project_name'],
:OS_PASSWORD => creds['password'],