¡@

Home 

OpenStack Study: rpc_notifier.py

OpenStack Index

**** CubicPower OpenStack Study ****

def notify(context, message):

    """Sends a notification via RPC."""

    if not context:

        context = req_context.get_admin_context()

    priority = message.get('priority',

                           CONF.default_notification_level)

    priority = priority.lower()

    for topic in CONF.notification_topics:

        topic = '%s.%s' % (topic, priority)

        try:

            rpc.notify(context, topic, message)

        except Exception:

            LOG.exception(_("Could not send notification to %(topic)s. "

                            "Payload=%(message)s"), locals())