report the URL when heartbeats fail

We have seen issues in misconfigured systems where messages from IPA
to ironic fail with 404 or other standard HTTP error codes. The
messages do not include the URL of the service IPA is trying to talk
to, which makes debugging the configuration difficult. This change
adds the URLs to the end of a couple of errors already being reported
to improve that situation.

Change-Id: I6a4ea8768df016e58a073d78edbe4006e217d69e
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2019-05-13 10:25:10 -04:00
parent 66d3c8e453
commit 21393cb1c5
1 changed files with 4 additions and 2 deletions

View File

@ -137,11 +137,13 @@ class IronicPythonAgentHeartbeater(threading.Thread):
self.error_delay = self.initial_delay
LOG.info('heartbeat successful')
except errors.HeartbeatConflictError:
LOG.warning('conflict error sending heartbeat')
LOG.warning('conflict error sending heartbeat to {}'.format(
self.agent.api_url))
self.error_delay = min(self.error_delay * self.backoff_factor,
self.max_delay)
except Exception:
LOG.exception('error sending heartbeat')
LOG.exception('error sending heartbeat to {}'.format(
self.agent.api_url))
self.error_delay = min(self.error_delay * self.backoff_factor,
self.max_delay)