Decorator and config option definitions for adding custom code (hooks) around callables.
NOTE: as of Nova 13.0 hooks are DEPRECATED and will be removed in the near future. You should not build any new code using this facility.
Any method may have the ‘add_hook’ decorator applied, which yields the ability to invoke Hook objects before or after the method. (i.e. pre and post)
Hook objects are loaded by HookLoaders. Each named hook may invoke multiple Hooks.
Example Hook object:
| class MyHook(object):
| def pre(self, *args, **kwargs):
| # do stuff before wrapped callable runs
|
| def post(self, rv, *args, **kwargs):
| # do stuff after wrapped callable runs
Example Hook object with function parameters:
| class MyHookWithFunction(object):
| def pre(self, f, *args, **kwargs):
| # do stuff with wrapped function info
| def post(self, f, *args, **kwargs):
| # do stuff with wrapped function info
Bases: exceptions.Exception
Exception which should be raised by hooks to indicate that normal execution of the hooked function should be terminated. Raised exception will be logged and reraised.
Bases: stevedore.hook.HookManager
Execute optional post methods of loaded hooks.
Parameters: |
|
---|
Execute optional pre methods of loaded hooks.
Parameters: |
|
---|
Execute optional pre and post methods around the decorated function. This is useful for customization around callables.
Clear loaded hooks.