Remove auth_uri usage

auth_uri in keystonemiddleware was deprecated and will be removed
in Stein.

This patch changed it to auth_url or www_authenticate_uri correctly

Change-Id: I754f6b27b3ebb87d4479aa366c9ee04af34fcaab
This commit is contained in:
wangxiyuan 2018-08-27 16:39:37 +08:00
parent c9d9e37c7d
commit 19dd18b17f
10 changed files with 18 additions and 12 deletions

View File

@ -25,8 +25,8 @@ from cinder import exception
from cinder.i18n import _
CONF = cfg.CONF
CONF.import_opt('auth_uri', 'keystonemiddleware.auth_token.__init__',
'keystone_authtoken')
CONF.import_group('keystone_authtoken',
'keystonemiddleware.auth_token.__init__')
LOG = logging.getLogger(__name__)
@ -227,7 +227,7 @@ def _keystone_client(context, version=(3, 0)):
:return: keystoneclient.client.Client object
"""
auth_plugin = identity.Token(
auth_url=CONF.keystone_authtoken.auth_uri,
auth_url=CONF.keystone_authtoken.auth_url,
token=context.auth_token,
project_id=context.project_id)
@ -237,7 +237,7 @@ def _keystone_client(context, version=(3, 0)):
cacert=CONF.keystone_authtoken.cafile,
key=CONF.keystone_authtoken.keyfile,
cert=CONF.keystone_authtoken.certfile)
return client.Client(auth_url=CONF.keystone_authtoken.auth_uri,
return client.Client(auth_url=CONF.keystone_authtoken.auth_url,
session=client_session, version=version)

View File

@ -28,6 +28,7 @@ import uuid
from eventlet import tpool
import fixtures
from keystonemiddleware import auth_token
import mock
from oslo_concurrency import lockutils
from oslo_config import fixture as config_fixture
@ -215,6 +216,11 @@ class TestCase(testtools.TestCase):
rpc.LAST_OBJ_VERSIONS = {}
rpc.LAST_RPC_VERSIONS = {}
# Init AuthProtocol to register some base options first, such as
# auth_url.
auth_token.AuthProtocol('fake_app', {'auth_type': 'password',
'auth_url': 'fake_url'})
conf_fixture.set_defaults(CONF)
CONF([], default_config_files=[])

View File

@ -117,7 +117,7 @@ class QuotaSetsControllerTestBase(test.TestCase):
self.auth_url = 'http://localhost:5000'
self.fixture = self.useFixture(config_fixture.Config(CONF))
self.fixture.config(auth_uri=self.auth_url, group='keystone_authtoken')
self.fixture.config(auth_url=self.auth_url, group='keystone_authtoken')
def _create_project_hierarchy(self):
r"""Sets an environment used for nested quotas tests.

View File

@ -56,4 +56,4 @@ def set_defaults(conf):
conf.set_default('policy_dirs', [], group='oslo_policy')
# This is where we don't authenticate
conf.set_default('auth_strategy', 'noauth')
conf.set_default('auth_uri', 'fake', 'keystone_authtoken')
conf.set_default('auth_url', 'fake', 'keystone_authtoken')

View File

@ -1451,7 +1451,7 @@ class NestedDbQuotaDriverBaseTestCase(DbQuotaDriverBaseTestCase):
self.addCleanup(keystone_patcher.stop)
self.fixture = self.useFixture(config_fixture.Config(CONF))
self.fixture.config(auth_uri=self.auth_url, group='keystone_authtoken')
self.fixture.config(auth_url=self.auth_url, group='keystone_authtoken')
self.driver = quota.NestedDbQuotaDriver()
def _mock_get_by_subproject(self):

View File

@ -43,7 +43,7 @@ class QuotaUtilsTest(test.TestCase):
self.auth_url = 'http://localhost:5000'
self.context = context.RequestContext('fake_user', 'fake_proj_id')
self.fixture = self.useFixture(config_fixture.Config(CONF))
self.fixture.config(auth_uri=self.auth_url, group='keystone_authtoken')
self.fixture.config(auth_url=self.auth_url, group='keystone_authtoken')
@mock.patch('keystoneclient.client.Client')
@mock.patch('keystoneauth1.session.Session')

View File

@ -277,7 +277,7 @@ Install and configure components
[keystone_authtoken]
# ...
auth_uri = http://controller:5000
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password

View File

@ -276,7 +276,7 @@ Install and configure components
[keystone_authtoken]
# ...
auth_uri = http://controller:5000
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password

View File

@ -158,7 +158,7 @@ Install and configure components
[keystone_authtoken]
# ...
auth_uri = http://controller:5000
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password

View File

@ -156,7 +156,7 @@ Install and configure components
[keystone_authtoken]
# ...
auth_uri = http://controller:5000
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password