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