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: I52fdeaaf773e0fc7e111e58ffb02ef9485eed260
This commit is contained in:
Matthias Bastian 2018-08-03 11:23:09 +02:00
parent dd0cc6650c
commit 24b9b667ed
4 changed files with 9 additions and 10 deletions

View File

@ -82,7 +82,7 @@ class Puppet::Provider::Nova < Puppet::Provider::Openstack
def self.get_nova_credentials
#needed keys for authentication
auth_keys = ['www_authenticate_uri', 'project_name', 'username', 'password']
auth_keys = ['auth_url', 'project_name', 'username', 'password']
conf = nova_conf
if conf and conf['keystone_authtoken'] and
auth_keys.all?{|k| !conf['keystone_authtoken'][k].nil?}
@ -111,7 +111,7 @@ class Puppet::Provider::Nova < Puppet::Provider::Openstack
def self.get_auth_endpoint
q = nova_credentials
"#{q['www_authenticate_uri']}"
"#{q['auth_url']}"
end
def self.auth_endpoint

View File

@ -50,7 +50,7 @@ Puppet::Type.newtype(:nova_aggregate) do
ensurable
autorequire(:nova_config) do
['www_authenticate_uri', 'project_name', 'username', 'password']
['auth_url', 'project_name', 'username', 'password']
end
newparam(:name, :namevar => true) do

View File

@ -56,7 +56,7 @@ Puppet::Type.newtype(:nova_flavor) do
ensurable
autorequire(:nova_config) do
['www_authenticate_uri', 'project_name', 'username', 'password']
['auth_url', 'project_name', 'username', 'password']
end
# Require the nova-api service to be running
@ -151,4 +151,3 @@ Puppet::Type.newtype(:nova_flavor) do
end
end

View File

@ -11,11 +11,11 @@ describe Puppet::Provider::Nova do
let :credential_hash do
{
'www_authenticate_uri' => 'https://192.168.56.210:5000/v2.0/',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
'region_name' => 'Region1',
'auth_url' => 'https://192.168.56.210:5000/v2.0/',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
'region_name' => 'Region1',
}
end