def notify_decorator(name, fn):
 def wrapped_func(*args, **kwarg):
  body = {}
  body['args'] = []
  body['kwarg'] = {}
  for arg in args:
   body['args'].append(arg)
  for key in kwarg:
   body['kwarg'][key] = kwarg[key]
  ctxt = (common_context.get_context_from_function_and_args(fn, args, kwarg) or common_context.get_current() or nova.context.RequestContext())
  notifier = rpc.get_notifier('api', publisher_id=(CONF.notifications.default_publisher_id or CONF.host))
  method = getattr(notifier, CONF.notifications.default_level.lower(), notifier.info)
  method(ctxt, name, body)
  return fn(*args, **kwarg)
 return wrapped_func

def notify_decorator ( name , fn ) : def wrapped_func ( * args , ** kwarg ) : body = { } body [ 'args' ] = [ ] body [ 'kwarg' ] = { } for arg in args : body [ 'args' ] . append ( arg ) for key in kwarg : body [ 'kwarg' ] [ key ] = kwarg [ key ] ctxt = ( common_context . get_context_from_function_and_args ( fn , args , kwarg ) or common_context . get_current ( ) or nova . context . RequestContext ( ) ) notifier = rpc . get_notifier ( 'api' , publisher_id = ( CONF . notifications . default_publisher_id or CONF . host ) ) method = getattr ( notifier , CONF . notifications . default_level . lower ( ) , notifier . info ) method ( ctxt , name , body ) return fn ( * args , ** kwarg ) return wrapped_func
decorator for notify which is used from utils .