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: Ia8ac773975c38cabadcb0bcecbb91f47cb70892d
This commit is contained in:
parent
79b720e932
commit
c9faaa537e
|
@ -75,7 +75,7 @@ class Puppet::Provider::Neutron < Puppet::Provider::Openstack
|
|||
|
||||
def self.get_neutron_credentials
|
||||
#needed keys for authentication
|
||||
auth_keys = ['www_authenticate_uri', 'project_name', 'username', 'password']
|
||||
auth_keys = ['auth_url', 'project_name', 'username', 'password']
|
||||
conf = neutron_conf
|
||||
if conf and conf['keystone_authtoken'] and
|
||||
auth_keys.all?{|k| !conf['keystone_authtoken'][k].nil?}
|
||||
|
@ -104,7 +104,7 @@ class Puppet::Provider::Neutron < Puppet::Provider::Openstack
|
|||
|
||||
def self.get_auth_endpoint
|
||||
q = neutron_credentials
|
||||
"#{q['www_authenticate_uri']}"
|
||||
"#{q['auth_url']}"
|
||||
end
|
||||
|
||||
def self.auth_endpoint
|
||||
|
|
|
@ -30,7 +30,7 @@ Puppet::Type.newtype(:neutron_security_group) do
|
|||
ensurable
|
||||
|
||||
autorequire(:neutron_config) do
|
||||
['www_authenticate_uri', 'project_name', 'username', 'password']
|
||||
['auth_url', 'project_name', 'username', 'password']
|
||||
end
|
||||
|
||||
# Require the neutron-server service to be running
|
||||
|
@ -73,4 +73,3 @@ Puppet::Type.newtype(:neutron_security_group) do
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@ describe Puppet::Provider::Neutron do
|
|||
|
||||
let :credential_hash do
|
||||
{
|
||||
'project_name' => 'admin_tenant',
|
||||
'username' => 'admin',
|
||||
'password' => 'password',
|
||||
'www_authenticate_uri' => 'https://192.168.56.210:5000/v2.0/',
|
||||
'project_domain_name' => 'Default',
|
||||
'user_domain_name' => 'Default',
|
||||
'project_name' => 'admin_tenant',
|
||||
'username' => 'admin',
|
||||
'password' => 'password',
|
||||
'auth_url' => 'https://192.168.56.210:5000/v2.0/',
|
||||
'project_domain_name' => 'Default',
|
||||
'user_domain_name' => 'Default',
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -65,7 +65,7 @@ describe Puppet::Provider::Neutron 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'],
|
||||
|
@ -79,7 +79,7 @@ describe Puppet::Provider::Neutron do
|
|||
|
||||
it 'should set region in the environment if needed' 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'],
|
||||
|
|
Loading…
Reference in New Issue