Fall back to www_authenthicate_uri

The [keystone_authtoken]/auth_uri setting was deprecated in
favour of [keystone_authtoken]/www_authenticate_uri. This
commit uses the new setting as the fallback if
[clients_keystone]/auth_uri has not been set.

Change-Id: I4b6e254b1344865e3775948a8bbf1e9aac196e4f
Story: #2004434
Task: #28097
This commit is contained in:
Johannes Grassler 2018-11-27 18:20:36 +01:00
parent 3c86a75834
commit 50260212ef
4 changed files with 5 additions and 5 deletions

View File

@ -34,5 +34,5 @@ def get_auth_uri(v3=True):
else:
# Import auth_token to have keystone_authtoken settings setup.
importutils.import_module('keystonemiddleware.auth_token')
auth_uri = cfg.CONF.keystone_authtoken.auth_uri
auth_uri = cfg.CONF.keystone_authtoken.www_authenticate_uri
return auth_uri.replace('v2.0', 'v3') if auth_uri and v3 else auth_uri

View File

@ -571,7 +571,7 @@ class Ec2TokenTest(common.HeatTestCase):
# Import auth_token to have keystone_authtoken settings setup.
importutils.import_module('keystonemiddleware.auth_token')
dummy_url = 'http://123:5000/v2.0'
cfg.CONF.set_override('auth_uri', dummy_url,
cfg.CONF.set_override('www_authenticate_uri', dummy_url,
group='keystone_authtoken')
ec2 = ec2token.EC2Token(app='woot', conf={})
params = {'AWSAccessKeyId': 'foo', 'Signature': 'xyz'}

View File

@ -45,7 +45,7 @@ class AuthUrlFilterTest(common.HeatTestCase):
def test_adds_default_auth_url_from_clients_keystone(self, mock_cfg):
self.config = {}
mock_cfg.clients_keystone.auth_uri = 'foobar'
mock_cfg.keystone_authtoken.auth_uri = 'this-should-be-ignored'
mock_cfg.keystone_authtoken.www_authenticate_uri = 'should-be-ignored'
mock_cfg.auth_password.multi_cloud = False
with mock.patch('keystoneauth1.discover.Discover') as discover:
class MockDiscover(object):
@ -62,7 +62,7 @@ class AuthUrlFilterTest(common.HeatTestCase):
def test_adds_default_auth_url_from_keystone_authtoken(self, mock_cfg):
self.config = {}
mock_cfg.clients_keystone.auth_uri = ''
mock_cfg.keystone_authtoken.auth_uri = 'foobar'
mock_cfg.keystone_authtoken.www_authenticate_uri = 'foobar'
mock_cfg.auth_password.multi_cloud = False
self.middleware = auth_url.AuthUrlFilter(self.app, self.config)
req = webob.Request.blank('/tenant_id/')

View File

@ -212,7 +212,7 @@ class TestRequestContext(common.HeatTestCase):
[clients_keystone] section.
"""
importutils.import_module('keystonemiddleware.auth_token')
cfg.CONF.set_override('auth_uri', 'http://abc/v2.0',
cfg.CONF.set_override('www_authenticate_uri', 'http://abc/v2.0',
group='keystone_authtoken')
policy_check = 'heat.common.policy.Enforcer.check_is_admin'
with mock.patch(policy_check) as pc: