Esempio n. 1
0
class Events(Referenceable, SignalBroadcaster):
    """The events of the system translated to ipc signals."""

    __metaclass__ = RemoteMeta

    # calls that will be accessible remotely
    remote_calls = [
        'push_event',
    ]

    def __init__(self, event_queue):
        super(Events, self).__init__()
        self.events = SyncdaemonEvents(event_queue)

    def emit_event(self, event):
        """Emit the signal."""
        event_dict = {}
        for key, value in event.iteritems():
            event_dict[str(key)] = str(value)
        self.emit_signal('on_event', event_dict)

    def push_event(self, event_name, args):
        """Push an event to the event queue."""
        logger.debug('push_event: %r with %r', event_name, args)
        self.events.push_event(event_name, args)
Esempio n. 2
0
 def __init__(self, event_queue):
     super(Events, self).__init__()
     self.events = SyncdaemonEvents(event_queue)