Fix bug if the switchover target is the same

This commit is contained in:
Joshua Boniface 2019-08-04 16:50:21 -04:00
parent a329376d33
commit d0d5ab4425
1 changed files with 3 additions and 0 deletions

View File

@ -306,6 +306,9 @@ class NodeInstance(object):
if stdout: if stdout:
self.logger.out('Successfully switched Patroni leader\n{}'.format(stdout), state='o') self.logger.out('Successfully switched Patroni leader\n{}'.format(stdout), state='o')
break break
elif stderr == "Error: Switchover target and source are the same.":
self.logger.out('Failed to switch Patroni leader to ourselves; this is fine\n{}'.format(stderr), state='w')
break
else: else:
self.logger.out('Failed to switch Patroni leader; retrying\n{}'.format(stderr), state='e') self.logger.out('Failed to switch Patroni leader; retrying\n{}'.format(stderr), state='e')
time.sleep(2) time.sleep(2)