From ba204884d874b1805f48ada50578ae7255761c73 Mon Sep 17 00:00:00 2001 From: Polina Bungina Date: Mon, 14 Aug 2023 20:36:46 +0200 Subject: [PATCH] Pass bare action name to should_run_scheduled_action() --- patroni/ha.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/patroni/ha.py b/patroni/ha.py index e133b8ac..28e7a6df 100644 --- a/patroni/ha.py +++ b/patroni/ha.py @@ -1228,10 +1228,11 @@ class Ha(object): return action = self._get_failover_action_name() + bare_action = action.replace('manual ', '') # it is not the time for the the scheduled failover yet, do nothing if (failover.scheduled_at and not - self.should_run_scheduled_action(action, failover.scheduled_at, lambda: + self.should_run_scheduled_action(bare_action, failover.scheduled_at, lambda: self.dcs.manual_failover('', '', version=failover.version))): return @@ -1244,9 +1245,9 @@ class Ha(object): return ret or f'{action}: demoting myself' else: logger.warning('%s: no healthy members found, %s is not possible', - action, action.replace('manual ', '')) + action, bare_action) else: - logger.warning('%s: I am already the leader, no need to %s', action, action.replace('manual ', '')) + logger.warning('%s: I am already the leader, no need to %s', action, bare_action) else: logger.warning('%s: leader name does not match: %s != %s', action, failover.leader, self.state_handler.name)