summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Hellmann <dhellmann@redhat.com>2019-06-26 11:47:42 -0400
committerJulia Kreger <juliaashleykreger@gmail.com>2020-07-30 20:57:09 +0000
commitb549e791795b82b197520e3fdbd1b71a47738d52 (patch)
tree863de2f3626c0a73b3875d7c74b022a6361b7abf
parent0819e416b029939f403a0b736ef302a02a01dfac (diff)
downloadironic-python-agent-b549e791795b82b197520e3fdbd1b71a47738d52.tar.gz
improve error messages during node lookup failures
The error messages reported on the console when the agent can't find its node do not give enough information to debug the cause of the failure. This change adds some basic details like the URL of the API server and the addresses of the node being sought there. Change-Id: Ia54faf05c80159d1d5fde0b222627c673f1cffe3 (cherry picked from commit f7740c7919584389e907f66bdfa1b4f31c75ead1)
-rw-r--r--ironic_python_agent/ironic_api_client.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/ironic_python_agent/ironic_api_client.py b/ironic_python_agent/ironic_api_client.py
index 20779871..cadd6876 100644
--- a/ironic_python_agent/ironic_api_client.py
+++ b/ironic_python_agent/ironic_api_client.py
@@ -148,12 +148,19 @@ class APIClient(object):
'GET', self.lookup_api,
headers=self._get_ironic_api_version_header(),
params=params)
- except Exception:
- LOG.exception('Lookup failed')
+ except Exception as err:
+ LOG.exception(
+ 'Unhandled error looking up node with addresses %r at %s: %s',
+ params['addresses'], self.api_url, err,
+ )
return False
if response.status_code != requests.codes.OK:
- LOG.warning('Failure status code: %s', response.status_code)
+ LOG.warning(
+ 'Failed looking up node with addresses %r at %s, '
+ 'status code: %s',
+ params['addresses'], self.api_url, response.status_code,
+ )
return False
try:
@@ -164,7 +171,11 @@ class APIClient(object):
# Check for valid response data
if 'node' not in content or 'uuid' not in content['node']:
- LOG.warning('Got invalid node data from the API: %s', content)
+ LOG.warning(
+ 'Got invalid node data in response to query for node '
+ 'with addresses %r from %s: %s',
+ params['addresses'], self.api_url, content,
+ )
return False
if 'config' not in content: