def _check_cluster_id(self, response):
cluster_id = response.headers.get("x-etcd-cluster-id")
if not cluster_id:
_log.warning("etcd response did not contain a cluster ID")
return
id_changed = (self.expected_cluster_id and
cluster_id != self.expected_cluster_id)
# Update the ID so we only raise the exception once.
old_expected_cluster_id = self.expected_cluster_id
self.expected_cluster_id = cluster_id
if id_changed:
# Defensive: clear the pool so that we connect afresh next
# time.
self._base_url = self._choice_machine()
_log.error(
'The UUID of the cluster changed from {} to '
'{}.'.format(old_expected_cluster_id, cluster_id))
评论列表
文章目录