Files
neutron-lib/releasenotes/notes/callbacksmanager-cancellable-events-966d76925db919a8.yaml
Rodolfo Alonso Hernandez 08b8c6d33b Add the "cancellable" flag to the `CallbacksManager` events
The ``CallbacksManager`` class considers, by default, that the events
starting with "before_" and "precommit_" can raise an Exception
(``CallbackFailure``) in case that the callbacks associated to these
methods exit with an error.

However there are some other events (those started with "after_") that
won't generate an exception in case of error. The error will be logged
but the process will continue.

This new functionality adds the possibility of adding any kind of event
and mark is as "cancellable". The ``CallbacksManager`` instance will check
the errors returned by the callback methods and if any of them is marked
as "cancellable", the manager will raise a ``CallbackFailure`` exception,
terminating the process.

In case of being a Neutron worker, for example, the
``oslo_service.service.Services`` class will restart the process again.

Related-Bug: #2036607
Change-Id: Ie1e7be6d70cca957c1b1b6c15b402e8bc6523865
2023-09-12 04:32:26 +00:00

9 lines
380 B
YAML

---
features:
- |
``CallbacksManager`` can now subscribe cancellable events. By default,
only ``before_`` and ``precommit_`` events, in case of error, can raise a
``CallbackFailure`` exception. Now, if the event is subscribed with
the flag ``cancellable`` enabled, the ``publish`` method will raise this
exception if the callback fails and returns an error.