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
This commit is contained in:
Mitya_Eremeev 2025-02-24 21:42:06 +03:00
parent 660658fe15
commit 0102671043

View File

@ -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)