]> git.ipfire.org Git - pbs.git/commitdiff
jobs: Don't fail when we cannot tail the log
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 24 Oct 2022 16:11:36 +0000 (16:11 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 24 Oct 2022 16:11:36 +0000 (16:11 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/jobs.py

index 72d0a874cb01482d6449b0d1b477c796ab716b8b..8e74861d5a00d16de84af4d13a1e451459f3f219 100644 (file)
@@ -445,8 +445,13 @@ class Job(base.DataObject):
                        Tails the log file (i.e. returns the N last lines)
                """
                # Open the log file
-               with await self.open_log() as f:
-                       return await asyncio.to_thread(self._tail_log, f, limit)
+               try:
+                       with await self.open_log() as f:
+                               return await asyncio.to_thread(self._tail_log, f, limit)
+
+               # Return nothing if the log could not be opened
+               except FileNotFoundError as e:
+                       return []
 
        def _tail_log(self, f, limit):
                # Create a new queue