Merge "improve error messages during node lookup failures" into stable/rocky

This commit is contained in:
Zuul 2020-08-24 14:44:15 +00:00 committed by Gerrit Code Review
commit 3669e26ed9

View File

@ -148,12 +148,19 @@ class APIClient(object):
'GET', self.lookup_api, 'GET', self.lookup_api,
headers=self._get_ironic_api_version_header(), headers=self._get_ironic_api_version_header(),
params=params) params=params)
except Exception: except Exception as err:
LOG.exception('Lookup failed') LOG.exception(
'Unhandled error looking up node with addresses %r at %s: %s',
params['addresses'], self.api_url, err,
)
return False return False
if response.status_code != requests.codes.OK: 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 return False
try: try:
@ -164,7 +171,11 @@ class APIClient(object):
# Check for valid response data # Check for valid response data
if 'node' not in content or 'uuid' not in content['node']: 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 return False
if 'config' not in content: if 'config' not in content: