Repository URL to install this package:
Version:
4.0.109 ▾
|
ó ±EYc @ s° d Z d d l Z d d l m Z d d l Z d d l m Z m Z m Z e j e Z d Z i Z d e f d YZ d e j j f d YZ e d Z d Z d S( sÜ 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 iÿÿÿÿN( t log( t _t _LEt _LWs nova.hookst FatalHookExceptionc B s e Z d Z RS( s³ 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. ( t __name__t __module__t __doc__( ( ( s? /home/tvault/.virtenv/lib/python2.7/site-packages/nova/hooks.pyR = s t HookManagerc B s5 e Z d Z d d Z d d Z d d Z RS( c C s# t t | j t | d t d S( s Invoke_on_load creates an instance of the Hook class :param name: The name of the hooks to load. :type name: str t invoke_on_loadN( t superR t __init__t NSt True( t selft name( ( s? /home/tvault/.virtenv/lib/python2.7/site-packages/nova/hooks.pyR F s c C sN | d k r' t d } t | n x | j D]} | j } t | | d } | r1 t j t d t j d i | d 6| d 6| d 6 y* | r¬ | | | | n | | | WqFt k rt d } t j | i | d 6| d 6| d 6 qFt k rBt d } t j | i | d 6| d 6| d 6 qFXq1 q1 Wd S( Nt pret posts= Wrong type of hook method. Only 'pre' and 'post' type allowedsL Hooks are deprecated as of Nova 13.0 and will be removed in a future releases' Running %(name)s %(type)s-hook: %(obj)sR t typet objs7 Fatal Exception running %(name)s %(type)s-hook: %(obj)ss1 Exception running %(name)s %(type)s-hook: %(obj)s( s pres post( R t ValueErrort extensionsR t getattrt Nonet LOGt warningR t debugR R t exceptiont Exception( R R t method_typet argst kwargst funct msgt eR t hook_method( ( s? /home/tvault/.virtenv/lib/python2.7/site-packages/nova/hooks.pyt _runN s. c C s, | j d | d d d | d | d | d S( s Execute optional pre methods of loaded hooks. :param name: The name of the loaded hooks. :param args: Positional arguments which would be transmitted into all pre methods of loaded hooks. :param kwargs: Keyword args which would be transmitted into all pre methods of loaded hooks. :param f: Target function. R R R R R R N( R$ ( R R R R t f( ( s? /home/tvault/.virtenv/lib/python2.7/site-packages/nova/hooks.pyt run_prem s !c C s3 | j d | d d d | f | d | d | d S( sÄ Execute optional post methods of loaded hooks. :param name: The name of the loaded hooks. :param rv: Return values of target method call. :param args: Positional arguments which would be transmitted into all post methods of loaded hooks. :param kwargs: Keyword args which would be transmitted into all post methods of loaded hooks. :param f: Target function. R R R R R R N( R$ ( R R t rvR R R% ( ( s? /home/tvault/.virtenv/lib/python2.7/site-packages/nova/hooks.pyt run_postz s "N( R R R R R$ R&