From 0102671043da2a31baeb8aba0cbdc0c4c3f029d3 Mon Sep 17 00:00:00 2001 From: Mitya_Eremeev Date: Mon, 24 Feb 2025 21:42:06 +0300 Subject: [PATCH] Make log levels more adequate 1) if some config option is not present in mapping file it's totally ok. It should not be there. Log it only for debug reasons. 2) Castellan as config source is mostly used for sensitive data, e.g. secrets, passwords, etc. If some config option is specified in mapping file, but Castellan id is not specified or is not present in Castellan backend, then it's an error. Service will take default values and produce awkward log messages about connection issues to database, RPC service, Keystone. There are no error mesasges from Castellan. Closes-Bug: #2099924 Change-Id: Ib9be08cf6cda7d6f2c5ed7d014b40ceee11104af --- castellan/_config_driver.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/castellan/_config_driver.py b/castellan/_config_driver.py index a7665f12..2fe7dc45 100644 --- a/castellan/_config_driver.py +++ b/castellan/_config_driver.py @@ -123,19 +123,19 @@ class CastellanConfigurationSource(sources.ConfigurationSource): except KeyError: # no mapping 'option = castellan_id' - LOG.info("option '[%s] %s' not present in '[%s] mapping_file'", - group_name, option_name, self._name) + LOG.debug("option '[%s] %s' not present in '[%s] mapping_file'", + group_name, option_name, self._name) except KeyManagerError: # bad mapping 'option =' without a castellan_id - LOG.warning("missing castellan_id for option " - "'[%s] %s' in '[%s] mapping_file'", - group_name, option_name, self._name) + LOG.error("missing castellan_id for option '[%s] %s' in '[%s] " + "mapping_file'", + group_name, option_name, self._name) except ManagedObjectNotFoundError: # good mapping, but unknown castellan_id by secret manager - LOG.warning("invalid castellan_id for option " - "'[%s] %s' in '[%s] mapping_file'", - group_name, option_name, self._name) + LOG.error("invalid castellan_id for option '[%s] %s' in '[%s] " + "mapping_file'", + group_name, option_name, self._name) return (sources._NoValue, None)