Minor agent token log handling
Agent token heartbeat failures can return InvalidParameterValue which was missed as an expected exception of the heartbeat action. This change adds the exception to the expected list so oslo_messaging doesn't generate a backtrace in the conductor log. Change-Id: Ia3dd7bb19cbdc325acc8445c7308843067b51a2b
This commit is contained in:
parent
1c0a9c8c28
commit
f73338c995
@ -3068,6 +3068,7 @@ class ConductorManager(base_manager.BaseConductorManager):
|
||||
return raid_iface.get_logical_disk_properties()
|
||||
|
||||
@METRICS.timer('ConductorManager.heartbeat')
|
||||
@messaging.expected_exceptions(exception.InvalidParameterValue)
|
||||
@messaging.expected_exceptions(exception.NoFreeConductorWorker)
|
||||
def heartbeat(self, context, node_id, callback_url, agent_version=None,
|
||||
agent_token=None):
|
||||
|
@ -907,6 +907,7 @@ class ConductorAPI(object):
|
||||
:param topic: RPC topic. Defaults to self.topic.
|
||||
:param agent_token: randomly generated validation token.
|
||||
:param agent_version: the version of the agent that is heartbeating
|
||||
:raises: InvalidParameterValue if an invalid agent token is received.
|
||||
"""
|
||||
new_kws = {}
|
||||
version = '1.34'
|
||||
|
@ -7031,9 +7031,10 @@ class DoNodeAdoptionTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
|
||||
mock_spawn.side_effect = self._fake_spawn
|
||||
|
||||
self.assertRaises(
|
||||
exception.InvalidParameterValue, self.service.heartbeat,
|
||||
exc = self.assertRaises(
|
||||
messaging.rpc.ExpectedException, self.service.heartbeat,
|
||||
self.context, node.uuid, 'http://callback', agent_token=None)
|
||||
self.assertEqual(exception.InvalidParameterValue, exc.exc_info[0])
|
||||
self.assertFalse(mock_heartbeat.called)
|
||||
|
||||
@mock.patch('ironic.drivers.modules.fake.FakeDeploy.heartbeat',
|
||||
@ -7106,10 +7107,11 @@ class DoNodeAdoptionTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
|
||||
mock_spawn.side_effect = self._fake_spawn
|
||||
|
||||
self.assertRaises(exception.InvalidParameterValue,
|
||||
self.service.heartbeat, self.context,
|
||||
node.uuid, 'http://callback',
|
||||
agent_token='evil', agent_version='5.0.0b23')
|
||||
exc = self.assertRaises(messaging.rpc.ExpectedException,
|
||||
self.service.heartbeat, self.context,
|
||||
node.uuid, 'http://callback',
|
||||
agent_token='evil', agent_version='5.0.0b23')
|
||||
self.assertEqual(exception.InvalidParameterValue, exc.exc_info[0])
|
||||
self.assertFalse(mock_heartbeat.called)
|
||||
|
||||
@mock.patch('ironic.drivers.modules.fake.FakeDeploy.heartbeat',
|
||||
@ -7133,10 +7135,11 @@ class DoNodeAdoptionTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
mock_spawn.side_effect = self._fake_spawn
|
||||
# Intentionally sending an older client in case something fishy
|
||||
# occurs.
|
||||
self.assertRaises(exception.InvalidParameterValue,
|
||||
self.service.heartbeat, self.context,
|
||||
node.uuid, 'http://callback',
|
||||
agent_token='evil', agent_version='4.0.0')
|
||||
exc = self.assertRaises(messaging.rpc.ExpectedException,
|
||||
self.service.heartbeat, self.context,
|
||||
node.uuid, 'http://callback',
|
||||
agent_token='evil', agent_version='4.0.0')
|
||||
self.assertEqual(exception.InvalidParameterValue, exc.exc_info[0])
|
||||
self.assertFalse(mock_heartbeat.called)
|
||||
|
||||
@mock.patch('ironic.drivers.modules.fake.FakeDeploy.heartbeat',
|
||||
@ -7158,10 +7161,11 @@ class DoNodeAdoptionTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
|
||||
mock_spawn.side_effect = self._fake_spawn
|
||||
|
||||
self.assertRaises(exception.InvalidParameterValue,
|
||||
self.service.heartbeat, self.context,
|
||||
node.uuid, 'http://callback',
|
||||
agent_token=None, agent_version='6.1.5')
|
||||
exc = self.assertRaises(messaging.rpc.ExpectedException,
|
||||
self.service.heartbeat, self.context,
|
||||
node.uuid, 'http://callback',
|
||||
agent_token=None, agent_version='6.1.5')
|
||||
self.assertEqual(exception.InvalidParameterValue, exc.exc_info[0])
|
||||
self.assertFalse(mock_heartbeat.called)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user