From 4fe7230dae788f7b61d08767e4fc93115a372306 Mon Sep 17 00:00:00 2001 From: Dragomir Penev Date: Thu, 16 Jan 2025 21:05:05 +0200 Subject: [PATCH] Tweaks of the split off scripts --- scripts/cluster_topology_observer.py | 5 +++-- scripts/rotate_logs.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/cluster_topology_observer.py b/scripts/cluster_topology_observer.py index 453f52c348..5cbc8cfc20 100644 --- a/scripts/cluster_topology_observer.py +++ b/scripts/cluster_topology_observer.py @@ -10,7 +10,8 @@ from time import sleep from urllib.request import urlopen -from constants import API_REQUEST_TIMEOUT, PATRONI_CLUSTER_STATUS_ENDPOINT +API_REQUEST_TIMEOUT = 5 +PATRONI_CLUSTER_STATUS_ENDPOINT = "cluster" # File path for the spawned cluster topology observer process to write logs. LOG_FILE_PATH = "/var/log/cluster_topology_observer.log" @@ -45,7 +46,7 @@ def main(): sleep(30) continue current_cluster_topology = { - member["name"]: member["role"] for member in cluster_status.json()["members"] + member["name"]: member["role"] for member in cluster_status["members"] } # If it's the first time the cluster topology was retrieved, then store it and use diff --git a/scripts/rotate_logs.py b/scripts/rotate_logs.py index f6f2c7a2ea..7fa617c94f 100644 --- a/scripts/rotate_logs.py +++ b/scripts/rotate_logs.py @@ -6,7 +6,7 @@ import subprocess from time import sleep -from constants import PGBACKREST_LOGROTATE_FILE +PGBACKREST_LOGROTATE_FILE = "/etc/logrotate.d/pgbackrest.logrotate" def main():