Merge "Use auth_uri to get nova credentials"

This commit is contained in:
Jenkins 2015-12-15 14:46:23 +00:00 committed by Gerrit Code Review
commit d93b9709af
2 changed files with 5 additions and 7 deletions

View File

@ -39,8 +39,8 @@ class Puppet::Provider::Nova < Puppet::Provider
def self.get_nova_credentials
#needed keys for authentication
auth_keys = ['auth_host', 'auth_port', 'auth_protocol',
'admin_tenant_name', 'admin_user', 'admin_password']
auth_keys = ['auth_uri', 'admin_tenant_name', 'admin_user',
'admin_password']
conf = nova_conf
if conf and conf['keystone_authtoken'] and
auth_keys.all?{|k| !conf['keystone_authtoken'][k].nil?}
@ -59,7 +59,7 @@ class Puppet::Provider::Nova < Puppet::Provider
def self.get_auth_endpoint
q = nova_credentials
"#{q['auth_protocol']}://#{q['auth_host']}:#{q['auth_port']}/v2.0/"
"#{q['auth_uri']}"
end
def self.auth_endpoint

View File

@ -11,9 +11,7 @@ describe Puppet::Provider::Nova do
let :credential_hash do
{
'auth_host' => '192.168.56.210',
'auth_port' => '35357',
'auth_protocol' => 'https',
'auth_uri' => 'https://192.168.56.210:35357/v2.0/',
'admin_tenant_name' => 'admin_tenant',
'admin_user' => 'admin',
'admin_password' => 'password',
@ -58,7 +56,7 @@ describe Puppet::Provider::Nova do
end.to raise_error(Puppet::Error, credential_error)
end
it 'should use specified host/port/protocol in the auth endpoint' do
it 'should use specified uri in the auth endpoint' do
conf = {'keystone_authtoken' => credential_hash}
klass.expects(:nova_conf).returns(conf)
expect(klass.get_auth_endpoint).to eq(auth_endpoint)