diff --git a/ironic_inspector/utils.py b/ironic_inspector/utils.py index e7b20064a..b8456e0cf 100644 --- a/ironic_inspector/utils.py +++ b/ironic_inspector/utils.py @@ -103,9 +103,9 @@ LOG = getProcessingLogger(__name__) class Error(Exception): """Inspector exception.""" - def __init__(self, msg, code=400, **kwargs): + def __init__(self, msg, code=400, log_level='error', **kwargs): super(Error, self).__init__(msg) - LOG.error(msg, **kwargs) + getattr(LOG, log_level)(msg, **kwargs) self.http_code = code @@ -113,7 +113,8 @@ class NotFoundInCacheError(Error): """Exception when node was not found in cache during processing.""" def __init__(self, msg, code=404): - super(NotFoundInCacheError, self).__init__(msg, code) + super(NotFoundInCacheError, self).__init__(msg, code, + log_level='info') def spawn_n(*args, **kwargs): diff --git a/releasenotes/notes/log-info-not-found-cache-error-afbc87e80305ca5c.yaml b/releasenotes/notes/log-info-not-found-cache-error-afbc87e80305ca5c.yaml new file mode 100644 index 000000000..70628dcc9 --- /dev/null +++ b/releasenotes/notes/log-info-not-found-cache-error-afbc87e80305ca5c.yaml @@ -0,0 +1,5 @@ +--- +other: + - Log level for error when node was not found in Inspector cache was + changed from error to info level. It was done because not_found_hook + may handle this case, so this wouldn't be error anymore.