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: I52fdeaaf773e0fc7e111e58ffb02ef9485eed260
(cherry picked from commit 24b9b667ed)
This commit is contained in:
Matthias Bastian
2018-08-03 11:23:09 +02:00
parent 1f4211feb8
commit 882066e876
4 changed files with 5 additions and 6 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 = ['auth_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['auth_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
['auth_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
['auth_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,7 +11,7 @@ describe Puppet::Provider::Nova do
let :credential_hash do
{
'auth_uri' => 'https://192.168.56.210:35357/v2.0/',
'auth_url' => 'https://192.168.56.210:35357/v2.0/',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',