Merge "Remove deprecated [keystone] config section"

This commit is contained in:
Zuul 2018-06-14 10:44:42 +00:00 committed by Gerrit Code Review
commit f917e3808e
13 changed files with 14 additions and 58 deletions

View File

@ -54,8 +54,6 @@ def get_client(context):
# NOTE(pas-ha) new option must always win if set # NOTE(pas-ha) new option must always win if set
if CONF.cinder.url and not CONF.cinder.endpoint_override: if CONF.cinder.url and not CONF.cinder.endpoint_override:
adapter_opts['endpoint_override'] = CONF.cinder.url adapter_opts['endpoint_override'] = CONF.cinder.url
if CONF.keystone.region_name and not CONF.cinder.region_name:
adapter_opts['region_name'] = CONF.keystone.region_name
adapter = keystone.get_adapter('cinder', session=session, adapter = keystone.get_adapter('cinder', session=session,
auth=service_auth, **adapter_opts) auth=service_auth, **adapter_opts)

View File

@ -98,11 +98,7 @@ def check_image_service(func):
service_auth = keystone.get_auth('glance') service_auth = keystone.get_auth('glance')
# TODO(pas-ha) remove in Rocky
adapter_params = {} adapter_params = {}
if CONF.keystone.region_name and not CONF.glance.region_name:
adapter_params['region_name'] = CONF.keystone.region_name
adapter = keystone.get_adapter('glance', session=session, adapter = keystone.get_adapter('glance', session=session,
auth=service_auth, **adapter_params) auth=service_auth, **adapter_params)
self.endpoint = adapter.get_endpoint() self.endpoint = adapter.get_endpoint()

View File

@ -70,8 +70,6 @@ def get_client(token=None, context=None):
adapter_params['endpoint_override'] = (CONF.neutron.url adapter_params['endpoint_override'] = (CONF.neutron.url
or DEFAULT_NEUTRON_URL) or DEFAULT_NEUTRON_URL)
else: else:
if CONF.keystone.region_name and not CONF.neutron.region_name:
adapter_params['region_name'] = CONF.keystone.region_name
if CONF.neutron.url and not CONF.neutron.endpoint_override: if CONF.neutron.url and not CONF.neutron.endpoint_override:
adapter_params['endpoint_override'] = CONF.neutron.url adapter_params['endpoint_override'] = CONF.neutron.url
adapter = keystone.get_adapter('neutron', session=session, adapter = keystone.get_adapter('neutron', session=session,

View File

@ -35,7 +35,6 @@ from ironic.conf import inspector
from ironic.conf import ipmi from ironic.conf import ipmi
from ironic.conf import irmc from ironic.conf import irmc
from ironic.conf import iscsi from ironic.conf import iscsi
from ironic.conf import keystone
from ironic.conf import metrics from ironic.conf import metrics
from ironic.conf import metrics_statsd from ironic.conf import metrics_statsd
from ironic.conf import neutron from ironic.conf import neutron
@ -69,7 +68,6 @@ inspector.register_opts(CONF)
ipmi.register_opts(CONF) ipmi.register_opts(CONF)
irmc.register_opts(CONF) irmc.register_opts(CONF)
iscsi.register_opts(CONF) iscsi.register_opts(CONF)
keystone.register_opts(CONF)
metrics.register_opts(CONF) metrics.register_opts(CONF)
metrics_statsd.register_opts(CONF) metrics_statsd.register_opts(CONF)
neutron.register_opts(CONF) neutron.register_opts(CONF)

View File

@ -1,33 +0,0 @@
# Copyright 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from ironic.common.i18n import _
opts = [
cfg.StrOpt('region_name',
deprecated_for_removal=True,
deprecated_reason=_("Use 'region_name' option in the following "
"sections - '[service_catalog]', "
"'[neutron]', '[glance]', '[cinder]', "
"'[swift]' and '[inspector]' to configure "
"region for those services individually."),
help=_('The region used for getting endpoints of OpenStack'
' services.')),
]
def register_opts(conf):
conf.register_opts(opts, group='keystone')

View File

@ -53,7 +53,6 @@ _opts = [
('ipmi', ironic.conf.ipmi.opts), ('ipmi', ironic.conf.ipmi.opts),
('irmc', ironic.conf.irmc.opts), ('irmc', ironic.conf.irmc.opts),
('iscsi', ironic.conf.iscsi.opts), ('iscsi', ironic.conf.iscsi.opts),
('keystone', ironic.conf.keystone.opts),
('metrics', ironic.conf.metrics.opts), ('metrics', ironic.conf.metrics.opts),
('metrics_statsd', ironic.conf.metrics_statsd.opts), ('metrics_statsd', ironic.conf.metrics_statsd.opts),
('neutron', ironic.conf.neutron.list_opts()), ('neutron', ironic.conf.neutron.list_opts()),

View File

@ -106,8 +106,6 @@ def get_ironic_api_url():
# NOTE(pas-ha) if both set, the new options win # NOTE(pas-ha) if both set, the new options win
if CONF.conductor.api_url and not CONF.service_catalog.endpoint_override: if CONF.conductor.api_url and not CONF.service_catalog.endpoint_override:
adapter_opts['endpoint_override'] = CONF.conductor.api_url adapter_opts['endpoint_override'] = CONF.conductor.api_url
if CONF.keystone.region_name and not CONF.service_catalog.region_name:
adapter_opts['region_name'] = CONF.keystone.region_name
adapter = keystone.get_adapter('service_catalog', **adapter_opts) adapter = keystone.get_adapter('service_catalog', **adapter_opts)
try: try:
ironic_api = adapter.get_endpoint() ironic_api = adapter.get_endpoint()

View File

@ -100,8 +100,6 @@ class TestCinderClient(base.TestCase):
def test_get_client_deprecated_opts(self, mock_client_init, mock_session, def test_get_client_deprecated_opts(self, mock_client_init, mock_session,
mock_auth, mock_sauth, mock_adapter): mock_auth, mock_sauth, mock_adapter):
self.config(region_name='test-region',
group='keystone')
self.config(url='http://test-url', group='cinder') self.config(url='http://test-url', group='cinder')
mock_adapter.return_value = mock_adapter_obj = mock.Mock() mock_adapter.return_value = mock_adapter_obj = mock.Mock()
mock_adapter_obj.get_endpoint.return_value = 'http://test-url' mock_adapter_obj.get_endpoint.return_value = 'http://test-url'
@ -111,7 +109,7 @@ class TestCinderClient(base.TestCase):
mock_session.assert_called_once_with('cinder') mock_session.assert_called_once_with('cinder')
mock_adapter.assert_called_once_with( mock_adapter.assert_called_once_with(
'cinder', session=mock.sentinel.session, auth=mock.sentinel.auth, 'cinder', session=mock.sentinel.session, auth=mock.sentinel.auth,
endpoint_override='http://test-url', region_name='test-region') endpoint_override='http://test-url')
self.assertFalse(mock_sauth.called) self.assertFalse(mock_sauth.called)

View File

@ -449,7 +449,6 @@ class CheckImageServiceTestCase(base.TestCase):
glance_cafile='cafile', glance_cafile='cafile',
region_name=None, region_name=None,
group='glance') group='glance')
self.config(region_name='OtherRegion', group='keystone')
wrapped_func = base_image_service.check_image_service(func) wrapped_func = base_image_service.check_image_service(func)
self.assertEqual(((), params), wrapped_func(self.service, **params)) self.assertEqual(((), params), wrapped_func(self.service, **params))
@ -460,7 +459,7 @@ class CheckImageServiceTestCase(base.TestCase):
cacert='cafile') cacert='cafile')
mock_adapter.assert_called_once_with( mock_adapter.assert_called_once_with(
'glance', session=mock.sentinel.session, 'glance', session=mock.sentinel.session,
auth=mock.sentinel.auth, region_name='OtherRegion') auth=mock.sentinel.auth)
self.assertEqual(0, mock_sauth.call_count) self.assertEqual(0, mock_sauth.call_count)
mock_auth.assert_called_once_with('glance') mock_auth.assert_called_once_with('glance')

View File

@ -28,8 +28,6 @@ class KeystoneTestCase(base.TestCase):
def setUp(self): def setUp(self):
super(KeystoneTestCase, self).setUp() super(KeystoneTestCase, self).setUp()
self.config(region_name='fake_region',
group='keystone')
self.test_group = 'test_group' self.test_group = 'test_group'
self.cfg_fixture.conf.register_group(cfg.OptGroup(self.test_group)) self.cfg_fixture.conf.register_group(cfg.OptGroup(self.test_group))
ironic_auth.register_auth_opts(self.cfg_fixture.conf, self.test_group, ironic_auth.register_auth_opts(self.cfg_fixture.conf, self.test_group,

View File

@ -125,8 +125,6 @@ class TestNeutronClient(base.TestCase):
mock_session, mock_session,
mock_adapter, mock_auth, mock_adapter, mock_auth,
mock_sauth): mock_sauth):
self.config(region_name='fake_region',
group='keystone')
self.config(url='neutron_url', self.config(url='neutron_url',
url_timeout=10, url_timeout=10,
timeout=None, timeout=None,
@ -139,7 +137,6 @@ class TestNeutronClient(base.TestCase):
mock_adapter.assert_called_once_with('neutron', mock_adapter.assert_called_once_with('neutron',
session=mock.sentinel.session, session=mock.sentinel.session,
auth=mock.sentinel.auth, auth=mock.sentinel.auth,
region_name='fake_region',
endpoint_override='neutron_url') endpoint_override='neutron_url')
def test_get_neutron_client_noauth(self, mock_client_init, mock_session, def test_get_neutron_client_noauth(self, mock_client_init, mock_session,

View File

@ -23,8 +23,6 @@ class AuthConfTestCase(base.TestCase):
def setUp(self): def setUp(self):
super(AuthConfTestCase, self).setUp() super(AuthConfTestCase, self).setUp()
self.config(region_name='fake_region',
group='keystone')
self.test_group = 'test_group' self.test_group = 'test_group'
self.cfg_fixture.conf.register_group(cfg.OptGroup(self.test_group)) self.cfg_fixture.conf.register_group(cfg.OptGroup(self.test_group))
ironic_auth.register_auth_opts(self.cfg_fixture.conf, self.test_group) ironic_auth.register_auth_opts(self.cfg_fixture.conf, self.test_group)

View File

@ -0,0 +1,12 @@
---
upgrade:
- |
Deprecated option ``[keystone]\region_name`` was removed and will be
ignored.
Instead use ``region_name`` option in other sections related to contacting
other services (``[service_catalog]``, ``[cinder]``, ``[glance]``,
``[neutron]``, [``swift``] and ``[inspector]``).
As the option ``[keystone]\region_name`` was the only option in
``[keystone]`` section of ironic configuration file, this section was
removed as well.