mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Cover case when failover is now and via DCS (#320)
Fix the bug with setting failover directly in DCS via patronictl. Fix by @Sulion
This commit is contained in:
+4
-3
@@ -590,12 +590,13 @@ def failover(config_file, cluster_name, master, candidate, force, dcs, scheduled
|
||||
|
||||
scheduled_at = parse_scheduled(scheduled)
|
||||
|
||||
scheduled_at_str = None
|
||||
if scheduled_at:
|
||||
if cluster.is_paused():
|
||||
raise PatroniCtlException("Can't schedule failover in the paused state")
|
||||
scheduled_at = scheduled_at.isoformat()
|
||||
scheduled_at_str = scheduled_at.isoformat()
|
||||
|
||||
failover_value = {'leader': master, 'candidate': candidate, 'scheduled_at': scheduled_at}
|
||||
failover_value = {'leader': master, 'candidate': candidate, 'scheduled_at': scheduled_at_str}
|
||||
|
||||
logging.debug(failover_value)
|
||||
|
||||
@@ -628,7 +629,7 @@ def failover(config_file, cluster_name, master, candidate, force, dcs, scheduled
|
||||
logging.warning('Failing over to DCS')
|
||||
click.echo(timestamp() + ' Could not failover using Patroni api, falling back to DCS')
|
||||
click.echo(timestamp() + ' Initializing failover from master {0}'.format(master))
|
||||
dcs.manual_failover(master, candidate, scheduled_at=failover_value)
|
||||
dcs.manual_failover(master, candidate, scheduled_at=scheduled_at)
|
||||
|
||||
output_members(cluster, cluster_name)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user