diff options
author | Dmitry Tantsur <dtantsur@protonmail.com> | 2023-03-17 13:19:57 +0100 |
---|---|---|
committer | Dmitry Tantsur <dtantsur@protonmail.com> | 2023-04-04 13:40:01 +0000 |
commit | 2280bdf84e22806e2f34fd751f72a79005130bf5 (patch) | |
tree | 6cfa966ef4c8bad3b62108939865a2d4729faa49 /ironic | |
parent | 943604cb417914194331b8ce5916766b50553128 (diff) | |
download | ironic-2280bdf84e22806e2f34fd751f72a79005130bf5.tar.gz |
Add error logging on lookup failures in the API
Lookup returns generic 404 errors for security reasons. Logging is
the only way of debugging any issues during it.
Change-Id: I860ed6b90468a403f0f6cdec9c3d84bc872fda06
(cherry picked from commit 21437135ab3a8c9aa2fea99c48ab42eb45630941)
Diffstat (limited to 'ironic')
-rw-r--r-- | ironic/api/controllers/v1/ramdisk.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ironic/api/controllers/v1/ramdisk.py b/ironic/api/controllers/v1/ramdisk.py index 5feef5e02..b98eb7dc2 100644 --- a/ironic/api/controllers/v1/ramdisk.py +++ b/ironic/api/controllers/v1/ramdisk.py @@ -131,13 +131,17 @@ class LookupController(rest.RestController): else: node = objects.Node.get_by_port_addresses( api.request.context, valid_addresses) - except exception.NotFound: + except exception.NotFound as e: # NOTE(dtantsur): we are reraising the same exception to make sure # we don't disclose the difference between nodes that are not found # at all and nodes in a wrong state by different error messages. + LOG.error('No node has been found during lookup: %s', e) raise exception.NotFound() if CONF.api.restrict_lookup and not self.lookup_allowed(node): + LOG.error('Lookup is not allowed for node %(node)s in the ' + 'provision state %(state)s', + {'node': node.uuid, 'state': node.provision_state}) raise exception.NotFound() if api_utils.allow_agent_token(): |