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'
```
This commit is contained in:
ksarabu1
2020-05-13 12:29:06 +02:00
committed by GitHub
parent a6fbc2dd7b
commit 2551684007
+1 -1
View File
@@ -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