File use-www-authenticate-uri.patch of Package openstack-heat
commit 50260212ef484c82e3bf58498ac83e163e7ee04d
Author: Johannes Grassler <johannes.grassler@suse.com>
Date: Tue Nov 27 18:20:36 2018 +0100
Upstream: submitted
References: https://review.openstack.org/#/c/620374/
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
diff --git a/heat/common/endpoint_utils.py b/heat/common/endpoint_utils.py
index 4c53a845998e..cb5b699ac554 100644
--- a/heat/common/endpoint_utils.py
+++ b/heat/common/endpoint_utils.py
@@ -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
diff --git a/heat/tests/api/aws/test_api_ec2token.py b/heat/tests/api/aws/test_api_ec2token.py
index ace9ba6d65dc..8a78749c8320 100644
--- a/heat/tests/api/aws/test_api_ec2token.py
+++ b/heat/tests/api/aws/test_api_ec2token.py
@@ -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'}
diff --git a/heat/tests/test_auth_url.py b/heat/tests/test_auth_url.py
index bc95cd58290f..0f9e4aabf07d 100644
--- a/heat/tests/test_auth_url.py
+++ b/heat/tests/test_auth_url.py
@@ -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/')
diff --git a/heat/tests/test_common_context.py b/heat/tests/test_common_context.py
index 0fb8f9d4e4e0..aa00a7660601 100644
--- a/heat/tests/test_common_context.py
+++ b/heat/tests/test_common_context.py
@@ -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: