From cc4d628463e4a21a9f3cd86cea4f4bc3d61a5530 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Sun, 22 Sep 2024 15:10:36 -0700 Subject: [PATCH] Fix error in test suite teardown The error seen was: Exception ignored in atexit callback: (WARNING)>> Traceback (most recent call last): File "/home/dan/src/salt/salt/_logging/handlers.py", line 68, in flush super().flush() File "/usr/local/lib/python3.10/logging/__init__.py", line 1084, in flush self.stream.flush() ValueError: I/O operation on closed file. --- salt/_logging/handlers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/salt/_logging/handlers.py b/salt/_logging/handlers.py index 7b751bdcef59..85c25865f602 100644 --- a/salt/_logging/handlers.py +++ b/salt/_logging/handlers.py @@ -65,7 +65,11 @@ def flush(self): super().handle(record) finally: self.__emitting = False - super().flush() + # Seeing an exception from calling flush on a closed file in the test + # suite. Handling this condition for now but this seems to be + # indicitive of an un-clean teardown at some point. + if not self.stream.closed: + super().flush() def sync_with_handlers(self, handlers=()): """