Trivial: Remove the long deprecated token arg
Change-Id: Ibe99dd907a72c707a20c77ec5f598583de3e179f
This commit is contained in:
@@ -28,8 +28,7 @@ class BaseDHCP(object, metaclass=abc.ABCMeta):
|
|||||||
"""Base class for DHCP provider APIs."""
|
"""Base class for DHCP provider APIs."""
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def update_port_dhcp_opts(self, port_id, dhcp_options, token=None,
|
def update_port_dhcp_opts(self, port_id, dhcp_options, context=None):
|
||||||
context=None):
|
|
||||||
"""Update one or more DHCP options on the specified port.
|
"""Update one or more DHCP options on the specified port.
|
||||||
|
|
||||||
:param port_id: designate which port these attributes
|
:param port_id: designate which port these attributes
|
||||||
@@ -44,16 +43,10 @@ class BaseDHCP(object, metaclass=abc.ABCMeta):
|
|||||||
{'opt_name': '66',
|
{'opt_name': '66',
|
||||||
'opt_value': '123.123.123.456',
|
'opt_value': '123.123.123.456',
|
||||||
'ip_version': 4}]
|
'ip_version': 4}]
|
||||||
:param token: An optional authentication token. Deprecated, use context
|
|
||||||
:param context: request context
|
:param context: request context
|
||||||
:type context: ironic.common.context.RequestContext
|
:type context: ironic.common.context.RequestContext
|
||||||
:raises: FailedToUpdateDHCPOptOnPort
|
: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
|
@abc.abstractmethod
|
||||||
def update_dhcp_opts(self, task, options, vifs=None):
|
def update_dhcp_opts(self, task, options, vifs=None):
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ LOG = logging.getLogger(__name__)
|
|||||||
class DnsmasqDHCPApi(base.BaseDHCP):
|
class DnsmasqDHCPApi(base.BaseDHCP):
|
||||||
"""API for managing host specific Dnsmasq configuration."""
|
"""API for managing host specific Dnsmasq configuration."""
|
||||||
|
|
||||||
def update_port_dhcp_opts(self, port_id, dhcp_options, token=None,
|
def update_port_dhcp_opts(self, port_id, dhcp_options, context=None):
|
||||||
context=None):
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def update_dhcp_opts(self, task, options, vifs=None):
|
def update_dhcp_opts(self, task, options, vifs=None):
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ LOG = logging.getLogger(__name__)
|
|||||||
class NeutronDHCPApi(base.BaseDHCP):
|
class NeutronDHCPApi(base.BaseDHCP):
|
||||||
"""API for communicating to neutron 2.x API."""
|
"""API for communicating to neutron 2.x API."""
|
||||||
|
|
||||||
def update_port_dhcp_opts(self, port_id, dhcp_options, token=None,
|
def update_port_dhcp_opts(self, port_id, dhcp_options, context=None):
|
||||||
context=None):
|
|
||||||
"""Update a port's attributes.
|
"""Update a port's attributes.
|
||||||
|
|
||||||
Update one or more DHCP options on the specified port.
|
Update one or more DHCP options on the specified port.
|
||||||
@@ -54,15 +53,14 @@ class NeutronDHCPApi(base.BaseDHCP):
|
|||||||
{'opt_name': '66',
|
{'opt_name': '66',
|
||||||
'opt_value': '123.123.123.456'},
|
'opt_value': '123.123.123.456'},
|
||||||
'ip_version': 4}]
|
'ip_version': 4}]
|
||||||
:param token: optional auth token. Deprecated, use context.
|
|
||||||
:param context: request context
|
:param context: request context
|
||||||
:type context: ironic.common.context.RequestContext
|
:type context: ironic.common.context.RequestContext
|
||||||
:raises: FailedToUpdateDHCPOptOnPort
|
:raises: FailedToUpdateDHCPOptOnPort
|
||||||
"""
|
"""
|
||||||
super(NeutronDHCPApi, self).update_port_dhcp_opts(
|
super(NeutronDHCPApi, self).update_port_dhcp_opts(
|
||||||
port_id, dhcp_options, token=token, context=context)
|
port_id, dhcp_options, context=context)
|
||||||
try:
|
try:
|
||||||
neutron_client = neutron.get_client(token=token, context=context)
|
neutron_client = neutron.get_client(context=context)
|
||||||
|
|
||||||
fips = []
|
fips = []
|
||||||
port = neutron_client.get_port(port_id)
|
port = neutron_client.get_port(port_id)
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ from ironic.dhcp import base
|
|||||||
class NoneDHCPApi(base.BaseDHCP):
|
class NoneDHCPApi(base.BaseDHCP):
|
||||||
"""No-op DHCP API."""
|
"""No-op DHCP API."""
|
||||||
|
|
||||||
def update_port_dhcp_opts(self, port_id, dhcp_options, token=None,
|
def update_port_dhcp_opts(self, port_id, dhcp_options, context=None):
|
||||||
context=None):
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def update_dhcp_opts(self, task, options, vifs=None):
|
def update_dhcp_opts(self, task, options, vifs=None):
|
||||||
|
|||||||
@@ -69,23 +69,6 @@ class TestNeutronClient(base.TestCase):
|
|||||||
client_mock.assert_called_once_with(oslo_conf=mock.ANY,
|
client_mock.assert_called_once_with(oslo_conf=mock.ANY,
|
||||||
session=mock.sentinel.session)
|
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,
|
def test_get_neutron_client_with_context(self, mock_client_init,
|
||||||
mock_session, mock_adapter,
|
mock_session, mock_adapter,
|
||||||
mock_auth, mock_sauth):
|
mock_auth, mock_sauth):
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
Remove unused and (pre-Rocky release) deprecated `token` parameter from
|
||||||
|
the DHCP driver interface method.
|
||||||
Reference in New Issue
Block a user