示例#1
0
文件: Inotify.py 项目: stpierre/bcfg2
 def __init__(self, ignore=None, debug=False):
     Pseudo.__init__(self, ignore=ignore, debug=debug)
     self.wm = pyinotify.WatchManager()
     self.notifier = pyinotify.ThreadedNotifier(self.wm, self)
     self.notifier.start()
     self.event_filter = dict()
     self.watches_by_path = dict()
示例#2
0
 def __init__(self, ignore=None, debug=False):
     Pseudo.__init__(self, ignore=ignore, debug=debug)
     pyinotify.ProcessEvent.__init__(self)
     self.event_filter = dict()
     self.watches_by_path = dict()
     # these are created in start() after the server is done forking
     self.notifier = None
     self.watchmgr = None
     self.add_q = []
示例#3
0
 def __init__(self, ignore=None, debug=False):
     Pseudo.__init__(self, ignore=ignore, debug=debug)
     pyinotify.ProcessEvent.__init__(self)
     self.event_filter = dict()
     self.watches_by_path = dict()
     # these are created in start() after the server is done forking
     self.notifier = None
     self.watchmgr = None
     self.add_q = []
示例#4
0
    def __init__(self, ignore=None, debug=False):
        Pseudo.__init__(self, ignore=ignore, debug=debug)
        pyinotify.ProcessEvent.__init__(self)

        #: inotify can't set useful monitors directly on files, only
        #: on directories, so when a monitor is added on a file we add
        #: its parent directory to ``event_filter`` and then only
        #: produce events on a file in that directory if the file is
        #: listed in ``event_filter``.  Keys are directories -- the
        #: parent directories of individual files that are monitored
        #: -- and values are lists of full paths to files in each
        #: directory that events *should* be produced for.  An event
        #: on a file whose parent directory is in ``event_filter`` but
        #: which is not itself listed will be silently suppressed.
        self.event_filter = dict()

        #: inotify doesn't like monitoring a path twice, so we keep a
        #: dict of :class:`pyinotify.Watch` objects, keyed by monitor
        #: path, to avoid trying to create duplicate monitors.
        #: (Duplicates can happen if an object accidentally requests
        #: duplicate monitors, or if two files in a single directory
        #: are both individually monitored, since inotify can't set
        #: monitors on the files but only on the parent directories.)
        self.watches_by_path = dict()

        #: The :class:`pyinotify.ThreadedNotifier` object.  This is
        #: created in :func:`start` after the server is done
        #: daemonizing.
        self.notifier = None

        #: The :class:`pyinotify.WatchManager` object. This is created
        #: in :func:`start` after the server is done daemonizing.
        self.watchmgr = None

        #: The queue used to record monitors that are added before
        #: :func:`start` has been called and :attr:`notifier` and
        #: :attr:`watchmgr` are created.
        self.add_q = []
示例#5
0
 def __init__(self, ignore=None, debug=False):
     Pseudo.__init__(self, ignore=ignore, debug=debug)
     self.wm = pyinotify.WatchManager()
     self.notifier = pyinotify.ThreadedNotifier(self.wm, self)
     self.notifier.start()
示例#6
0
文件: Inotify.py 项目: m4z/bcfg2
 def __init__(self, ignore=None, debug=False):
     Pseudo.__init__(self, ignore=ignore, debug=debug)
     self.wm = pyinotify.WatchManager()
     self.notifier = pyinotify.ThreadedNotifier(self.wm, self)
     self.notifier.start()