From 642666b15eb14fa1f5410f1122d8359b40de66e0 Mon Sep 17 00:00:00 2001 From: Matthias Bastian Date: Fri, 3 Aug 2018 11:35:38 +0200 Subject: [PATCH] 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: I16145064b8867c64abddf4a12f460464ee2d9c04 --- lib/puppet/provider/cinder.rb | 4 ++-- spec/unit/provider/cinder_spec.rb | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/puppet/provider/cinder.rb b/lib/puppet/provider/cinder.rb index 0f1821f3..52371030 100644 --- a/lib/puppet/provider/cinder.rb +++ b/lib/puppet/provider/cinder.rb @@ -52,7 +52,7 @@ class Puppet::Provider::Cinder < Puppet::Provider::Openstack end def self.get_cinder_credentials - auth_keys = ['www_authenticate_uri', 'project_name', 'username', + auth_keys = ['auth_url', 'project_name', 'username', 'password'] conf = cinder_conf if conf and conf['keystone_authtoken'] and @@ -82,7 +82,7 @@ class Puppet::Provider::Cinder < Puppet::Provider::Openstack def self.get_auth_endpoint q = cinder_credentials - "#{q['www_authenticate_uri']}" + "#{q['auth_url']}" end def self.auth_endpoint diff --git a/spec/unit/provider/cinder_spec.rb b/spec/unit/provider/cinder_spec.rb index ebc48cd2..619b85a5 100644 --- a/spec/unit/provider/cinder_spec.rb +++ b/spec/unit/provider/cinder_spec.rb @@ -24,19 +24,19 @@ describe Puppet::Provider::Cinder do it 'should read conf file with all sections' do creds_hash = { - 'www_authenticate_uri' => 'https://192.168.56.210:5000/v2.0/', - 'project_name' => 'admin_tenant', - 'username' => 'admin', - 'password' => 'password', - 'project_domain_name' => 'Default', - 'user_domain_name' => 'Default', + 'auth_url' => 'https://192.168.56.210:5000/v2.0/', + 'project_name' => 'admin_tenant', + 'username' => 'admin', + 'password' => 'password', + 'project_domain_name' => 'Default', + 'user_domain_name' => 'Default', } mock = { 'keystone_authtoken' => { - 'www_authenticate_uri' => 'https://192.168.56.210:5000/v2.0/', - 'project_name' => 'admin_tenant', - 'username' => 'admin', - 'password' => 'password', + 'auth_url' => 'https://192.168.56.210:5000/v2.0/', + 'project_name' => 'admin_tenant', + 'username' => 'admin', + 'password' => 'password', } } Puppet::Util::IniConfig::File.expects(:new).returns(mock)