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: Ie40e48d0ccd83657de753f92cd8c0018baf8ef8d
This commit is contained in:
parent
387fffa197
commit
f505d6fc8b
@ -29,7 +29,7 @@ class Puppet::Provider::Ironic < Puppet::Provider
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.get_ironic_credentials
|
def self.get_ironic_credentials
|
||||||
auth_keys = ['www_authenticate_uri', 'project_name', 'username', 'password']
|
auth_keys = ['auth_url', 'project_name', 'username', 'password']
|
||||||
conf = ironic_conf
|
conf = ironic_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?}
|
||||||
@ -67,7 +67,7 @@ correctly configured.")
|
|||||||
def self.auth_ironic(*args)
|
def self.auth_ironic(*args)
|
||||||
q = ironic_credentials
|
q = ironic_credentials
|
||||||
authenv = {
|
authenv = {
|
||||||
:OS_AUTH_URL => q['www_authenticate_uri'],
|
:OS_AUTH_URL => q['auth_url'],
|
||||||
:OS_USERNAME => q['username'],
|
:OS_USERNAME => q['username'],
|
||||||
:OS_PROJECT_NAME => q['project_name'],
|
:OS_PROJECT_NAME => q['project_name'],
|
||||||
:OS_PASSWORD => q['password'],
|
:OS_PASSWORD => q['password'],
|
||||||
|
@ -11,12 +11,12 @@ describe Puppet::Provider::Ironic 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/',
|
'auth_url' => 'https://192.168.56.210:5000/',
|
||||||
'project_domain_name' => 'admin_tenant_domain',
|
'project_domain_name' => 'admin_tenant_domain',
|
||||||
'user_domain_name' => 'admin_domain',
|
'user_domain_name' => 'admin_domain',
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ describe Puppet::Provider::Ironic 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'],
|
||||||
|
Loading…
Reference in New Issue
Block a user