示例#1
0
    def process_IN_DELETE(self, event):
        self.check_delete_file(event)
        filename = event.pathname

        if not check_deny_file(filename):
            clog.debug('[DELETE] filename: %s' % filename)
            content.delete_file(filename)
            self.update_event_dir_list(filename)
            self.up_to_date = False
示例#2
0
    def check_delete_file(self, event):
            # No previous MOVED_FROM event.
            if self._moved_from_cookie_prev == 0:
                return

            # One of the other events except MOVED_FROM came in.
            elif event.mask != pyinotify.IN_MOVED_TO and event.mask != pyinotify.IN_MOVED_FROM:
                clog.debug('[1] No MOVED_* Event. Removing previous MOVED_FROM file.')
                content.delete_file(self._moved_from_file)
                self.up_to_date = False
                self._moved_from_cookie_prev = 0
                self._moved_from_file = ''

            # Another MOVED_FROM event came in. Delete previous MOVED_FROM file.
            elif event.mask == pyinotify.IN_MOVED_FROM:
                clog.debug('[2] Another MOVED_FROM event. Removing previous MOVED_FROM file.')
                content.delete_file(self._moved_from_file)
                self.up_to_date = False
                self._moved_from_cookie_prev = event.cookie
                self._moved_from_file = event.pathname
            else:
                log.exception('[ERROR] Unexpected case!')