コード例 #1
0
 def notify(self, event_id, **kwargs):
     notification = Notification(
         event_id,
         self._send_notification,
         self.json_binding.bridge
     )
     notification.emit(**kwargs)
コード例 #2
0
ファイル: jsonRpcHelper.py プロジェクト: gobindadas/vdsm
    def notify(self, event_id, params=None):
        if not params:
            params = {}

        notification = Notification(event_id, self._send_notification,
                                    self.json_binding.bridge.event_schema)
        notification.emit(params)
コード例 #3
0
ファイル: jsonRpcHelper.py プロジェクト: EdDev/vdsm
    def notify(self, event_id, params=None):
        if not params:
            params = {}

        notification = Notification(
            event_id,
            self._send_notification,
            self.json_binding.bridge.event_schema
        )
        notification.emit(params)
コード例 #4
0
ファイル: clientIF.py プロジェクト: kanalun/vdsm
 def notify(self, event_id, **kwargs):
     """
     Send notification using provided subscription id as
     event_id and a dictionary as event body. Before sending
     there is notify_time added on top level to the dictionary.
     """
     notification = Notification(
         event_id,
         self._send_notification,
     )
     notification.emit(**kwargs)
コード例 #5
0
 def notify(self, event_id, **kwargs):
     """
     Send notification using provided subscription id as
     event_id and a dictionary as event body. Before sending
     there is notify_time added on top level to the dictionary.
     """
     notification = Notification(
         event_id,
         self._send_notification,
     )
     notification.emit(**kwargs)
コード例 #6
0
ファイル: jsonRpcHelper.py プロジェクト: wuyeliang/vdsm
    def notify(self, event_id, params=None, destination=None):
        if not params:
            params = {}

        if destination is None:
            destination = self.dest

        server = self.json_binding.reactor.server

        notification = Notification(
            event_id, lambda message: server.send(message, destination),
            self.json_binding.bridge.event_schema)
        notification.emit(params)
コード例 #7
0
ファイル: jsonRpcHelper.py プロジェクト: nirs/vdsm
    def notify(self, event_id, params=None, destination=None):
        if not params:
            params = {}

        if destination is None:
            destination = self.dest

        server = self.json_binding.reactor.server

        notification = Notification(
            event_id,
            lambda message: server.send(message, destination),
            self.json_binding.bridge.event_schema
        )
        notification.emit(params)
コード例 #8
0
    def notify(self, event_id, **kwargs):
        """
        Send notification using provided subscription id as
        event_id and a dictionary as event body. Before sending
        there is notify_time added on top level to the dictionary.
        """
        if not self.ready:
            self.log.warning('Not ready yet, ignoring event %r args=%r',
                             event_id, kwargs)
            return

        notification = Notification(
            event_id,
            self._send_notification,
        )
        notification.emit(**kwargs)
コード例 #9
0
ファイル: clientIF.py プロジェクト: andrewlukoshko/vdsm
    def notify(self, event_id, **kwargs):
        """
        Send notification using provided subscription id as
        event_id and a dictionary as event body. Before sending
        there is notify_time added on top level to the dictionary.
        """
        if not self.ready:
            self.log.warning('Not ready yet, ignoring event %r args=%r',
                             event_id, kwargs)
            return

        notification = Notification(
            event_id,
            self._send_notification,
        )
        notification.emit(**kwargs)
コード例 #10
0
ファイル: jsonrpcclient.py プロジェクト: nirs/vdsm
    def notify(self, event_id, dest, event_schema, params=None):
        """
        JsonRpcClient notify method, sends an event on a spesific queue

        Args:
            event_id (string): unique event name
            dest (string): destination queue
            event_schema (Schema): a schema for vdsm events
            params (dict): event content

        Returns:
            None
        """
        if not params:
            params = {}

        def send_notification(message):
            self._transport.send(message, dest)

        notification = Notification(event_id, send_notification, event_schema)
        notification.emit(params)
コード例 #11
0
    def notify(self, event_id, dest, event_schema, params=None):
        """
        JsonRpcClient notify method, sends an event on a spesific queue

        Args:
            event_id (string): unique event name
            dest (string): destination queue
            event_schema (Schema): a schema for vdsm events
            params (dict): event content

        Returns:
            None
        """
        if not params:
            params = {}

        def send_notification(message):
            self._transport.send(message, dest)

        notification = Notification(event_id, send_notification, event_schema)
        notification.emit(params)
コード例 #12
0
    def notify(self, event_id, **kwargs):
        """
        Send notification using provided subscription id as
        event_id and a dictionary as event body. Before sending
        there is notify_time added on top level to the dictionary.
        """
        if not self.ready:
            self.log.warning('Not ready yet, ignoring event %r args=%r',
                             event_id, kwargs)
            return

        json_binding = self.bindings['jsonrpc']

        def _send_notification(message):
            json_binding.reactor.server.send(
                message, config.get('addresses', 'event_queue'))

        try:
            notification = Notification(event_id, _send_notification,
                                        json_binding.bridge)
            notification.emit(**kwargs)
        except KeyError:
            self.log.warning("Attempt to send an event when jsonrpc binding"
                             " not available")
コード例 #13
0
    def notify(self, event_id, params=None):
        """
        Send notification using provided subscription id as
        event_id and a dictionary as event body. Before sending
        there is notify_time added on top level to the dictionary.

        Please consult event-schema.yml in order to build an appropriate event.
        https://github.com/oVirt/vdsm/blob/master/lib/api/vdsm-events.yml

        Args:
            event_id (string): unique event name
            params (dict): event content
        """
        if not params:
            params = {}

        if not self.ready:
            self.log.warning('Not ready yet, ignoring event %r args=%r',
                             event_id, params)
            return

        json_binding = self.servers['jsonrpc']

        def _send_notification(message):
            json_binding.reactor.server.send(
                message, config.get('addresses', 'event_queue'))

        try:
            notification = Notification(event_id, _send_notification,
                                        json_binding.bridge.event_schema)
            notification.emit(params)
            self.log.debug("Sending notification %s with params %s ", event_id,
                           params)
        except KeyError:
            self.log.warning("Attempt to send an event when jsonrpc binding"
                             " not available")
コード例 #14
0
ファイル: clientIF.py プロジェクト: EdDev/vdsm
    def notify(self, event_id, params=None):
        """
        Send notification using provided subscription id as
        event_id and a dictionary as event body. Before sending
        there is notify_time added on top level to the dictionary.

        Please consult event-schema.yml in order to build an appropriate event.
        https://github.com/oVirt/vdsm/blob/master/lib/api/vdsm-events.yml

        Args:
            event_id (string): unique event name
            params (dict): event content
        """
        if not params:
            params = {}

        if not self.ready:
            self.log.warning('Not ready yet, ignoring event %r args=%r',
                             event_id, params)
            return

        json_binding = self.servers['jsonrpc']

        def _send_notification(message):
            json_binding.reactor.server.send(
                message, config.get('addresses', 'event_queue'))

        try:
            notification = Notification(event_id, _send_notification,
                                        json_binding.bridge.event_schema)
            notification.emit(params)
            self.log.debug("Sending notification %s with params %s ",
                           event_id, params)
        except KeyError:
            self.log.warning("Attempt to send an event when jsonrpc binding"
                             " not available")
コード例 #15
0
    def notify(self, event_id, **kwargs):
        """
        Send notification using provided subscription id as
        event_id and a dictionary as event body. Before sending
        there is notify_time added on top level to the dictionary.
        """
        if not self.ready:
            self.log.warning('Not ready yet, ignoring event %r args=%r',
                             event_id, kwargs)
            return

        json_binding = self.bindings['jsonrpc']

        def _send_notification(message):
            json_binding.reactor.server.send(
                message, config.get('addresses', 'event_queue'))

        try:
            notification = Notification(event_id, _send_notification,
                                        json_binding.bridge)
            notification.emit(**kwargs)
        except KeyError:
            self.log.warning("Attempt to send an event when jsonrpc binding"
                             " not available")
コード例 #16
0
ファイル: jsonRpcHelper.py プロジェクト: rexhsu/vdsm-debian
 def notify(self, event_id, **kwargs):
     notification = Notification(
         event_id,
         self._send_notification,
     )
     notification.emit(**kwargs)
コード例 #17
0
ファイル: jsonRpcHelper.py プロジェクト: rexhsu/vdsm
 def notify(self, event_id, **kwargs):
     notification = Notification(event_id, self._send_notification,
                                 self.json_binding.bridge)
     notification.emit(**kwargs)
コード例 #18
0
ファイル: jsonRpcHelper.py プロジェクト: sshnaidm/vdsm
 def notify(self, event_id, **kwargs):
     notification = Notification(
         event_id,
         self._send_notification,
     )
     notification.emit(**kwargs)