summaryrefslogtreecommitdiff
path: root/ironic
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@protonmail.com>2019-07-26 14:24:22 +0200
committerDmitry Tantsur <dtantsur@protonmail.com>2019-07-26 14:24:22 +0200
commit441575dc50c7e35d65b197774092e83feed66962 (patch)
tree182c653a40d05731b4f8d84c78a2bc252004f122 /ironic
parent3958c94fa8ad8aa431d6f2e5ecaf54edfe27f3eb (diff)
downloadironic-441575dc50c7e35d65b197774092e83feed66962.tar.gz
Remove deprecated Neutron authentication options
Change-Id: Iab4d570426336c1e85888b4bb21ff26bb1200761
Diffstat (limited to 'ironic')
-rw-r--r--ironic/common/keystone.py4
-rw-r--r--ironic/common/neutron.py18
-rw-r--r--ironic/conf/neutron.py33
-rw-r--r--ironic/tests/unit/common/test_neutron.py30
-rw-r--r--ironic/tests/unit/dhcp/test_factory.py4
5 files changed, 9 insertions, 80 deletions
diff --git a/ironic/common/keystone.py b/ironic/common/keystone.py
index c31036944..90645e168 100644
--- a/ironic/common/keystone.py
+++ b/ironic/common/keystone.py
@@ -115,7 +115,9 @@ def get_endpoint(group, **adapter_kwargs):
"""
result = get_adapter(group, **adapter_kwargs).get_endpoint()
if not result:
- service_type = adapter_kwargs.get('service_type', 'baremetal')
+ service_type = adapter_kwargs.get(
+ 'service_type',
+ getattr(getattr(CONF, group), 'service_type', group))
endpoint_type = adapter_kwargs.get('endpoint_type', 'internal')
raise exception.CatalogNotFound(
service_type=service_type, endpoint_type=endpoint_type)
diff --git a/ironic/common/neutron.py b/ironic/common/neutron.py
index f74e80440..1be288bdb 100644
--- a/ironic/common/neutron.py
+++ b/ironic/common/neutron.py
@@ -48,8 +48,7 @@ def _get_neutron_session():
if not _NEUTRON_SESSION:
_NEUTRON_SESSION = keystone.get_session(
'neutron',
- # TODO(pas-ha) remove in Rocky
- timeout=CONF.neutron.timeout or CONF.neutron.url_timeout)
+ timeout=CONF.neutron.timeout)
return _NEUTRON_SESSION
@@ -63,21 +62,8 @@ def get_client(token=None, context=None):
session = _get_neutron_session()
service_auth = keystone.get_auth('neutron')
- # TODO(pas-ha) remove in Rocky, always simply load from config
- # 'noauth' then would correspond to 'auth_type=none' and
- # 'endpoint_override'
- adapter_params = {}
- if (CONF.neutron.auth_strategy == 'noauth'
- and CONF.neutron.auth_type is None):
- CONF.set_override('auth_type', 'none', group='neutron')
- if not CONF.neutron.endpoint_override:
- adapter_params['endpoint_override'] = (CONF.neutron.url
- or DEFAULT_NEUTRON_URL)
- else:
- if CONF.neutron.url and not CONF.neutron.endpoint_override:
- adapter_params['endpoint_override'] = CONF.neutron.url
endpoint = keystone.get_endpoint('neutron', session=session,
- auth=service_auth, **adapter_params)
+ auth=service_auth)
user_auth = None
if CONF.neutron.auth_type != 'none' and context.auth_token:
diff --git a/ironic/conf/neutron.py b/ironic/conf/neutron.py
index d2d7f41fb..277a34fa5 100644
--- a/ironic/conf/neutron.py
+++ b/ironic/conf/neutron.py
@@ -20,25 +20,6 @@ from ironic.common.i18n import _
from ironic.conf import auth
opts = [
- cfg.StrOpt('url',
- deprecated_for_removal=True,
- deprecated_reason=_("Use [neutron]/endpoint_override option "
- "instead. It has no default value and must "
- "be set explicitly if required to connect "
- "to specific neutron URL, for example "
- "in stand alone mode when "
- "[neutron]/auth_type is 'none'."),
- help=_("URL for connecting to neutron. "
- "Default value translates to 'http://$my_ip:9696' "
- "when auth_strategy is 'noauth', "
- "and to discovery from Keystone catalog "
- "when auth_strategy is 'keystone'.")),
- cfg.IntOpt('url_timeout',
- default=30,
- deprecated_for_removal=True,
- deprecated_reason=_("Set the desired value explicitly using "
- "the [neutron]/timeout option instead."),
- help=_('Timeout value for connecting to neutron in seconds.')),
cfg.IntOpt('port_setup_delay',
default=0,
min=0,
@@ -47,20 +28,6 @@ opts = [
cfg.IntOpt('retries',
default=3,
help=_('Client retries in the case of a failed request.')),
- cfg.StrOpt('auth_strategy',
- default='keystone',
- choices=[('keystone', _('use the Identity service for '
- 'authentication')),
- ('noauth', _('no authentication'))],
- deprecated_for_removal=True,
- deprecated_reason=_("To configure neutron for noauth mode, "
- "set [neutron]/auth_type = none and "
- "[neutron]/endpoint_override="
- "<NEUTRON_API_URL> instead"),
- help=_('Authentication strategy to use when connecting to '
- 'neutron. Running neutron in noauth mode (related to '
- 'but not affected by this setting) is insecure and '
- 'should only be used for testing.')),
cfg.StrOpt('cleaning_network',
help=_('Neutron network UUID or name for the ramdisk to be '
'booted into for cleaning nodes. Required for "neutron" '
diff --git a/ironic/tests/unit/common/test_neutron.py b/ironic/tests/unit/common/test_neutron.py
index 181365928..85de690eb 100644
--- a/ironic/tests/unit/common/test_neutron.py
+++ b/ironic/tests/unit/common/test_neutron.py
@@ -16,7 +16,6 @@ from keystoneauth1 import loading as kaloading
import mock
from neutronclient.common import exceptions as neutron_client_exc
from neutronclient.v2_0 import client
-from oslo_config import cfg
from oslo_utils import uuidutils
from ironic.common import context
@@ -125,30 +124,10 @@ class TestNeutronClient(base.TestCase):
auth=mock.sentinel.auth)
self.assertEqual(0, mock_sauth.call_count)
- def test_get_neutron_client_with_deprecated_opts(self, mock_client_init,
- mock_session,
- mock_adapter, mock_auth,
- mock_sauth):
- self.config(url='neutron_url',
- url_timeout=10,
- timeout=None,
- service_type=None,
- group='neutron')
- mock_adapter.return_value = adapter = mock.Mock()
- adapter.get_endpoint.return_value = 'neutron_url'
- self._call_and_assert_client(mock_client_init, 'neutron_url')
- mock_session.assert_called_once_with('neutron', timeout=10)
- mock_adapter.assert_called_once_with('neutron',
- session=mock.sentinel.session,
- auth=mock.sentinel.auth,
- endpoint_override='neutron_url')
-
def test_get_neutron_client_noauth(self, mock_client_init, mock_session,
mock_adapter, mock_auth, mock_sauth):
- self.config(auth_strategy='noauth',
- endpoint_override='neutron_url',
- url_timeout=None,
- auth_type=None,
+ self.config(endpoint_override='neutron_url',
+ auth_type='none',
timeout=10,
group='neutron')
mock_adapter.return_value = adapter = mock.Mock()
@@ -164,11 +143,6 @@ class TestNeutronClient(base.TestCase):
mock_auth.assert_called_once_with('neutron')
self.assertEqual(0, mock_sauth.call_count)
- def test_out_range_auth_strategy(self, mock_client_init, mock_session,
- mock_adapter, mock_auth, mock_eauth):
- self.assertRaises(ValueError, cfg.CONF.set_override,
- 'auth_strategy', 'fake', 'neutron')
-
class TestNeutronNetworkActions(db_base.DbTestCase):
diff --git a/ironic/tests/unit/dhcp/test_factory.py b/ironic/tests/unit/dhcp/test_factory.py
index b72a565b1..c6b30535a 100644
--- a/ironic/tests/unit/dhcp/test_factory.py
+++ b/ironic/tests/unit/dhcp/test_factory.py
@@ -31,8 +31,8 @@ class TestDHCPFactory(base.TestCase):
def setUp(self):
super(TestDHCPFactory, self).setUp()
- self.config(url='test-url',
- url_timeout=30,
+ self.config(endpoint_override='test-url',
+ timeout=30,
group='neutron')
dhcp_factory.DHCPFactory._dhcp_provider = None
self.addCleanup(setattr, dhcp_factory.DHCPFactory,