Trivial: Remove the long deprecated token arg

Change-Id: Ibe99dd907a72c707a20c77ec5f598583de3e179f
This commit is contained in:
cid
2025-02-01 07:02:54 +01:00
parent 8bbfb60f85
commit 778f8f09fb
6 changed files with 11 additions and 34 deletions

View File

@ -28,8 +28,7 @@ class BaseDHCP(object, metaclass=abc.ABCMeta):
"""Base class for DHCP provider APIs."""
@abc.abstractmethod
def update_port_dhcp_opts(self, port_id, dhcp_options, token=None,
context=None):
def update_port_dhcp_opts(self, port_id, dhcp_options, context=None):
"""Update one or more DHCP options on the specified port.
:param port_id: designate which port these attributes
@ -44,16 +43,10 @@ class BaseDHCP(object, metaclass=abc.ABCMeta):
{'opt_name': '66',
'opt_value': '123.123.123.456',
'ip_version': 4}]
:param token: An optional authentication token. Deprecated, use context
:param context: request context
:type context: ironic.common.context.RequestContext
:raises: FailedToUpdateDHCPOptOnPort
"""
# TODO(pas-ha) ignore token arg in Rocky
if token:
LOG.warning("Using the 'token' argument is deprecated, "
"use the 'context' argument to pass the "
"full request context instead.")
@abc.abstractmethod
def update_dhcp_opts(self, task, options, vifs=None):

View File

@ -27,8 +27,7 @@ LOG = logging.getLogger(__name__)
class DnsmasqDHCPApi(base.BaseDHCP):
"""API for managing host specific Dnsmasq configuration."""
def update_port_dhcp_opts(self, port_id, dhcp_options, token=None,
context=None):
def update_port_dhcp_opts(self, port_id, dhcp_options, context=None):
pass
def update_dhcp_opts(self, task, options, vifs=None):

View File

@ -34,8 +34,7 @@ LOG = logging.getLogger(__name__)
class NeutronDHCPApi(base.BaseDHCP):
"""API for communicating to neutron 2.x API."""
def update_port_dhcp_opts(self, port_id, dhcp_options, token=None,
context=None):
def update_port_dhcp_opts(self, port_id, dhcp_options, context=None):
"""Update a port's attributes.
Update one or more DHCP options on the specified port.
@ -54,15 +53,14 @@ class NeutronDHCPApi(base.BaseDHCP):
{'opt_name': '66',
'opt_value': '123.123.123.456'},
'ip_version': 4}]
:param token: optional auth token. Deprecated, use context.
:param context: request context
:type context: ironic.common.context.RequestContext
:raises: FailedToUpdateDHCPOptOnPort
"""
super(NeutronDHCPApi, self).update_port_dhcp_opts(
port_id, dhcp_options, token=token, context=context)
port_id, dhcp_options, context=context)
try:
neutron_client = neutron.get_client(token=token, context=context)
neutron_client = neutron.get_client(context=context)
fips = []
port = neutron_client.get_port(port_id)

View File

@ -19,8 +19,7 @@ from ironic.dhcp import base
class NoneDHCPApi(base.BaseDHCP):
"""No-op DHCP API."""
def update_port_dhcp_opts(self, port_id, dhcp_options, token=None,
context=None):
def update_port_dhcp_opts(self, port_id, dhcp_options, context=None):
pass
def update_dhcp_opts(self, task, options, vifs=None):

View File

@ -69,23 +69,6 @@ class TestNeutronClient(base.TestCase):
client_mock.assert_called_once_with(oslo_conf=mock.ANY,
session=mock.sentinel.session)
@mock.patch('ironic.common.context.RequestContext', autospec=True)
def test_get_neutron_client_with_token(self, mock_ctxt, mock_client_init,
mock_session, mock_adapter,
mock_auth, mock_sauth):
mock_ctxt.return_value = ctxt = mock.Mock()
ctxt.auth_token = 'test-token-123'
ctxt.system_scope = None
neutron.get_client(token='test-token-123')
mock_ctxt.assert_called_once_with(auth_token='test-token-123')
mock_client_init.assert_called_once_with(oslo_conf=mock.ANY,
session=mock.sentinel.session)
# testing handling of default url_timeout
mock_session.assert_has_calls(
[mock.call('neutron', timeout=10),
mock.call('neutron', auth=mock.sentinel.sauth, timeout=10)])
def test_get_neutron_client_with_context(self, mock_client_init,
mock_session, mock_adapter,
mock_auth, mock_sauth):

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
Remove unused and (pre-Rocky release) deprecated `token` parameter from
the DHCP driver interface method.