From b7c535598246e12dc678e608f38302be9abbfd88 Mon Sep 17 00:00:00 2001 From: Bruno Bompastor Date: Wed, 2 Dec 2015 11:38:23 +0100 Subject: [PATCH] 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 --- lib/puppet/provider/nova.rb | 6 +++--- spec/unit/provider/nova_spec.rb | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/puppet/provider/nova.rb b/lib/puppet/provider/nova.rb index 06b90c5a8..1faa51bb7 100644 --- a/lib/puppet/provider/nova.rb +++ b/lib/puppet/provider/nova.rb @@ -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 diff --git a/spec/unit/provider/nova_spec.rb b/spec/unit/provider/nova_spec.rb index 46608a0df..acd3bd9ac 100644 --- a/spec/unit/provider/nova_spec.rb +++ b/spec/unit/provider/nova_spec.rb @@ -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)