Merge "Minor agent token log handling"
This commit is contained in:
commit
a63672f485
@ -3064,6 +3064,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'
|
||||
|
@ -7185,9 +7185,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',
|
||||
@ -7260,10 +7261,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',
|
||||
@ -7287,10 +7289,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',
|
||||
@ -7312,10 +7315,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