From 1a5cf9d23534c13b38483fd30626143b2b8bcd2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 27 Jun 2024 04:05:20 +0200 Subject: [PATCH] policy-daemon: invalidate cache on file move too Invalidate cache not only when file is modified inside policy dir, but also when it's moved in or out. --- qrexec/policy/utils.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/qrexec/policy/utils.py b/qrexec/policy/utils.py index e4ec15d4..cce5757f 100644 --- a/qrexec/policy/utils.py +++ b/qrexec/policy/utils.py @@ -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() @@ -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 + + def process_IN_MOVED_FROM(self, _): + self.cache.outdated = True