Merge "Follow-up review comments"

This commit is contained in:
Jenkins 2017-01-13 03:27:55 +00:00 committed by Gerrit Code Review
commit 49418ae810
3 changed files with 3 additions and 5 deletions

View File

@ -121,13 +121,11 @@ class CallbacksManager(object):
the payload object is not an instance of BaseEvent. CallbackFailure the payload object is not an instance of BaseEvent. CallbackFailure
is raise if the underlying callback has errors. is raise if the underlying callback has errors.
""" """
kwargs = {}
if payload: if payload:
if not isinstance(payload, events.EventPayload): if not isinstance(payload, events.EventPayload):
raise exceptions.Invalid(element='event payload', raise exceptions.Invalid(element='event payload',
value=type(payload)) value=type(payload))
kwargs['payload'] = payload return self.notify(resource, event, trigger, payload=payload)
return self.notify(resource, event, trigger, **kwargs)
# NOTE(boden): We plan to deprecate the usage of this method and **kwargs # NOTE(boden): We plan to deprecate the usage of this method and **kwargs
# as the payload in Queens, but no warning here to avoid log flooding # as the payload in Queens, but no warning here to avoid log flooding

View File

@ -38,7 +38,7 @@ class EventPayloadTestCase(base.BaseTestCase):
e = events.EventPayload(mock.ANY, states=['s1', 's2']) e = events.EventPayload(mock.ANY, states=['s1', 's2'])
self.assertEqual(['s1', 's2'], e.states) self.assertEqual(['s1', 's2'], e.states)
e.states.append('state') e.states.append('state')
self.assertTrue('state' in e.states) self.assertIn('state', e.states)
def test_resource_id(self): def test_resource_id(self):
e = events.EventPayload(mock.ANY, resource_id='id1') e = events.EventPayload(mock.ANY, resource_id='id1')

View File

@ -6,7 +6,7 @@ features:
standardized way. standardized way.
- A test fixture is provided for isolating the global callback manager in - A test fixture is provided for isolating the global callback manager in
``neutron_lib.callbacks.registry``. For more details see the comments in ``neutron_lib.callbacks.registry``. For more details see the comments in
``neutron_lib.tests.unti.callbacks.base``. ``neutron_lib.fixture.CallbackRegistryFixture``.
deprecations: deprecations:
- The use of ``neutron_lib.callbacks.registry.notify()`` and - The use of ``neutron_lib.callbacks.registry.notify()`` and
``neutron_lib.callbacks.manager.CallbacksManager.notify()`` is deprecated in ``neutron_lib.callbacks.manager.CallbacksManager.notify()`` is deprecated in