The nova.hooks Module

Decorator and config option definitions for adding custom code (hooks) around callables.

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
class HookManager(name)

Bases: stevedore.hook.HookManager

run_post(name, rv, args, kwargs)
run_pre(name, args, kwargs)
add_hook(name)

Execute optional pre and post methods around the decorated function. This is useful for customization around callables.

reset()

Clear loaded hooks.

Previous topic

The nova.filters Module

Next topic

The nova.image.glance Module

This Page