Skip to content

Commit

Permalink
policy-daemon: invalidate cache on file move too
Browse files Browse the repository at this point in the history
Invalidate cache not only when file is modified inside policy dir, but
also when it's moved in or out.
  • Loading branch information
marmarek committed Jun 27, 2024
1 parent c17ee39 commit 1a5cf9d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion qrexec/policy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ def initialize_watcher(self):
self.watch_manager = pyinotify.WatchManager()

# pylint: disable=no-member
mask = pyinotify.IN_CREATE | pyinotify.IN_DELETE | pyinotify.IN_MODIFY
mask = (
pyinotify.IN_CREATE |
pyinotify.IN_DELETE |
pyinotify.IN_MODIFY |
pyinotify.IN_MOVED_FROM |
pyinotify.IN_MOVED_TO
)

loop = asyncio.get_event_loop()

Expand Down Expand Up @@ -105,3 +111,9 @@ def process_IN_DELETE(self, _):

def process_IN_MODIFY(self, _):
self.cache.outdated = True

def process_IN_MOVED_TO(self, _):
self.cache.outdated = True

Check warning on line 116 in qrexec/policy/utils.py

View check run for this annotation

Codecov / codecov/patch

qrexec/policy/utils.py#L116

Added line #L116 was not covered by tests

def process_IN_MOVED_FROM(self, _):
self.cache.outdated = True

Check warning on line 119 in qrexec/policy/utils.py

View check run for this annotation

Codecov / codecov/patch

qrexec/policy/utils.py#L119

Added line #L119 was not covered by tests

0 comments on commit 1a5cf9d

Please sign in to comment.