From 3a9c17837208419584ce10e4182116e7f769302b Mon Sep 17 00:00:00 2001 From: Brett Holman Date: Tue, 19 Sep 2023 17:23:53 -0600 Subject: [PATCH] cloudinit.log: Use more appropriate exception (#4435) cloud-init's logging code has for a long time caught and ignored a bare Exception. Use a more specific exception for the expected case that this handles. --- cloudinit/log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudinit/log.py b/cloudinit/log.py index 5a0d725b0384..34aea58a3d64 100644 --- a/cloudinit/log.py +++ b/cloudinit/log.py @@ -88,7 +88,7 @@ def setupLogging(cfg=None): # The default configuration includes an attempt at using /dev/log, # followed up by writing to a file. /dev/log will not exist in # very early boot, so an exception on that is expected. - with suppress(Exception): + with suppress(FileNotFoundError): am_tried += 1 # If the value is not a filename, assume that it is a config.