Use auth_uri to get nova credentials

This change updates the puppet-nova module to use the new keys
for authentication, since auth_host, auth_port and auth_protocol
were deprecated in favor of auth_uri.

Change-Id: Id0183eaf8a93d45b6374777ddcf80c0f3f2dbebb
Closes-Bug: #1521539
This commit is contained in:
Bruno Bompastor
2015-12-02 11:38:23 +01:00
parent 2a4e110a7e
commit b7c5355982
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 def self.get_nova_credentials
#needed keys for authentication #needed keys for authentication
auth_keys = ['auth_host', 'auth_port', 'auth_protocol', auth_keys = ['auth_uri', 'admin_tenant_name', 'admin_user',
'admin_tenant_name', 'admin_user', 'admin_password'] 'admin_password']
conf = nova_conf conf = nova_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?}
@@ -59,7 +59,7 @@ class Puppet::Provider::Nova < Puppet::Provider
def self.get_auth_endpoint def self.get_auth_endpoint
q = nova_credentials q = nova_credentials
"#{q['auth_protocol']}://#{q['auth_host']}:#{q['auth_port']}/v2.0/" "#{q['auth_uri']}"
end end
def self.auth_endpoint def self.auth_endpoint

View File

@@ -11,9 +11,7 @@ describe Puppet::Provider::Nova do
let :credential_hash do let :credential_hash do
{ {
'auth_host' => '192.168.56.210', 'auth_uri' => 'https://192.168.56.210:35357/v2.0/',
'auth_port' => '35357',
'auth_protocol' => 'https',
'admin_tenant_name' => 'admin_tenant', 'admin_tenant_name' => 'admin_tenant',
'admin_user' => 'admin', 'admin_user' => 'admin',
'admin_password' => 'password', 'admin_password' => 'password',
@@ -58,7 +56,7 @@ describe Puppet::Provider::Nova do
end.to raise_error(Puppet::Error, credential_error) end.to raise_error(Puppet::Error, credential_error)
end 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} conf = {'keystone_authtoken' => credential_hash}
klass.expects(:nova_conf).returns(conf) klass.expects(:nova_conf).returns(conf)
expect(klass.get_auth_endpoint).to eq(auth_endpoint) expect(klass.get_auth_endpoint).to eq(auth_endpoint)