Exemplo n.º 1
0
    def _notify(self, event_qualifier, required_traits, optional_traits,
                **kwargs):
        self.payload.update(kwargs)
        self.validate(self.required_base_traits() + required_traits)
        available_values = self.serialize(self.context)
        payload = {
            k: available_values[k]
            for k in self.required_base_traits() + required_traits
        }
        for k in optional_traits:
            if k in available_values:
                payload[k] = available_values[k]

        qualified_event_type = (DBaaSAPINotification.event_type_format %
                                (self.event_type(), event_qualifier))
        LOG.debug('Sending event: %(event_type)s, %(payload)s' % {
            'event_type': qualified_event_type,
            'payload': payload
        })

        context = copy.copy(self.context)
        del context.notification
        notifier = rpc.get_notifier(service=self.payload['server_type'])
        notifier.info(context, qualified_event_type, self.payload)
        if self.notify_callback:
            self.notify_callback(event_qualifier)
Exemplo n.º 2
0
def publish_exist_events(transformer, admin_context):
    notifier = rpc.get_notifier("taskmanager")
    notifications = transformer()
    # clear out admin_context.auth_token so it does not get logged
    admin_context.auth_token = None
    for notification in notifications:
        notifier.info(admin_context, "trove.instance.exists", notification)
Exemplo n.º 3
0
def publish_exist_events(transformer, admin_context):
    notifier = rpc.get_notifier("taskmanager")
    notifications = transformer()
    # clear out admin_context.auth_token so it does not get logged
    admin_context.auth_token = None
    for notification in notifications:
        notifier.info(admin_context, "trove.instance.exists", notification)
Exemplo n.º 4
0
    def notify(self):
        LOG.debug('Sending event: %(event_type)s, %(payload)s' %
                  {'event_type': DBaaSQuotas.event_type,
                   'payload': self.payload})

        notifier = rpc.get_notifier(
            service='taskmanager', publisher_id=CONF.host)

        notifier.info(self.context, DBaaSQuotas.event_type, self.payload)
Exemplo n.º 5
0
    def notify(self, event_type, publisher_id=CONF.host):
        event_type = self.event_type_format % event_type
        event_payload = self.serialize(self.context)
        LOG.debug('Sending event: %(event_type)s, %(payload)s' %
                  {'event_type': event_type, 'payload': event_payload})

        notifier = rpc.get_notifier(
            service='taskmanager', publisher_id=publisher_id)
        notifier.info(self.context, event_type, event_payload)
Exemplo n.º 6
0
    def notify(self, event_type, publisher_id=None):
        publisher_id = publisher_id or CONF.host
        event_type = self.event_type_format % event_type
        event_payload = self.serialize(self.context)
        LOG.debug('Sending event: %(event_type)s, %(payload)s' %
                  {'event_type': event_type, 'payload': event_payload})

        notifier = rpc.get_notifier(
            service='taskmanager', publisher_id=publisher_id)
        notifier.info(self.context, event_type, event_payload)
Exemplo n.º 7
0
    def _notify(self, event_qualifier, required_traits, optional_traits,
                **kwargs):
        self.payload.update(kwargs)
        self.validate(self.required_base_traits() + required_traits)
        available_values = self.serialize(self.context)
        payload = {k: available_values[k]
                   for k in self.required_base_traits() + required_traits}
        for k in optional_traits:
            if k in available_values:
                payload[k] = available_values[k]

        qualified_event_type = (DBaaSAPINotification.event_type_format
                                % (self.event_type(), event_qualifier))
        LOG.debug('Sending event: %(event_type)s, %(payload)s' %
                  {'event_type': qualified_event_type, 'payload': payload})

        context = copy.copy(self.context)
        del context.notification
        notifier = rpc.get_notifier(service=self.payload['server_type'])
        notifier.info(context, qualified_event_type, self.payload)