From 075918d447cbe87c09eef76b875225134abfc382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hrvoje=20Milkovi=C4=87?= Date: Wed, 16 Feb 2022 10:20:15 +0100 Subject: [PATCH] Fixed AttributeError no attribute 'leader' (#2217) Close https://github.com/zalando/patroni/issues/2218 --- patroni/ha.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patroni/ha.py b/patroni/ha.py index 5943baee..9e0f9b84 100644 --- a/patroni/ha.py +++ b/patroni/ha.py @@ -796,7 +796,7 @@ class Ha(object): # When in sync mode, only last known master and sync standby are allowed to promote automatically. all_known_members = self.cluster.members + self.old_cluster.members - if self.is_synchronous_mode() and self.cluster.sync.leader: + if self.is_synchronous_mode() and self.cluster.sync and self.cluster.sync.leader: if not self.cluster.sync.matches(self.state_handler.name): return False # pick between synchronous candidates so we minimize unnecessary failovers/demotions