Пример #1
0
def send(stack):
    """Send usage notifications to the configured notification driver."""

    publisher_id = CONF.default_publisher_id
    if publisher_id is None:
        publisher_id = notifier_api.publisher_id(SERVICE)

    # The current notifications have a start/end:
    # see: https://wiki.openstack.org/wiki/SystemUsageData
    # so to be consistant we translate our status into a known start/end/error
    # suffix.
    level = CONF.default_notification_level.upper()
    if stack.status == stack.IN_PROGRESS:
        suffix = 'start'
    elif stack.status == stack.COMPLETE:
        suffix = 'end'
    else:
        suffix = 'error'
        level = notifier_api.ERROR

    event_type = '%s.%s.%s' % (SERVICE, stack.action.lower(), suffix)

    notifier_api.notify(stack.context, publisher_id,
                        event_type, level,
                        engine_api.format_notification_body(stack))
Пример #2
0
def send(stack):
    """Send usage notifications to the configured notification driver."""

    publisher_id = CONF.default_publisher_id
    if publisher_id is None:
        publisher_id = notifier_api.publisher_id(SERVICE)

    # The current notifications have a start/end:
    # see: https://wiki.openstack.org/wiki/SystemUsageData
    # so to be consistant we translate our status into a known start/end/error
    # suffix.
    level = CONF.default_notification_level.upper()
    if stack.status == stack.IN_PROGRESS:
        suffix = 'start'
    elif stack.status == stack.COMPLETE:
        suffix = 'end'
    else:
        suffix = 'error'
        level = notifier_api.ERROR

    event_type = '%s.%s.%s' % (SERVICE, stack.action.lower(), suffix)

    notifier_api.notify(stack.context, publisher_id, event_type, level,
                        engine_api.format_notification_body(stack))
Пример #3
0
 def _notify(self, ctxt, event_type, payload, priority):
     notifier_api.notify(ctxt, self.publisher_id, event_type, priority,
                         payload)
Пример #4
0
 def _notify(self, ctxt, event_type, payload, priority):
     notifier_api.notify(ctxt,
                         self.publisher_id,
                         event_type,
                         priority,
                         payload)
Пример #5
0
def notify(context, event_type, level, body):

    notifier_api.notify(context, _get_default_publisher(),
                        "%s.%s" % (SERVICE, event_type),
                        level, body)