From 25516840073b174df3c02f083ce608c4d77580eb Mon Sep 17 00:00:00 2001 From: ksarabu1 <62157128+ksarabu1@users.noreply.github.com> Date: Wed, 13 May 2020 06:29:06 -0400 Subject: [PATCH] bugfix for attribute error during bootstrap (#1538) initial bootstrap by attaching Patroni to the running postgres was causing the following error. ``` File "/xx/lib/python3.8/site-packages/patroni/ha.py", line 529, in update_cluster_history history = history[-self.cluster.config.max_timelines_history:] AttributeError: 'NoneType' object has no attribute 'max_timelines_history' ``` --- patroni/ha.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patroni/ha.py b/patroni/ha.py index c0655ea0..7a0e0adb 100644 --- a/patroni/ha.py +++ b/patroni/ha.py @@ -525,7 +525,7 @@ class Ha(object): elif not cluster_history or cluster_history[-1][0] != master_timeline - 1 or len(cluster_history[-1]) != 4: cluster_history = {line[0]: line for line in cluster_history or []} history = self.state_handler.get_history(master_timeline) - if history: + if history and self.cluster.config: history = history[-self.cluster.config.max_timelines_history:] for line in history: # enrich current history with promotion timestamps stored in DCS