Fixed AttributeError no attribute 'leader' (#2217)

Close https://github.com/zalando/patroni/issues/2218
This commit is contained in:
Hrvoje Milković
2022-02-16 10:20:15 +01:00
committed by GitHub
parent c4535ae208
commit 075918d447
+1 -1
View File
@@ -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