mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Bugfix, hostname and address are not keys of dict but properties of Member object
This commit is contained in:
+2
-2
@@ -96,9 +96,9 @@ class Etcd:
|
||||
def current_leader(self):
|
||||
try:
|
||||
cluster = self.get_cluster()
|
||||
if not cluster['leader'] or not cluster['leader'].address:
|
||||
if not cluster.leader or not cluster.leader.address:
|
||||
return None
|
||||
return cluster['leader']
|
||||
return cluster.leader
|
||||
except:
|
||||
raise CurrentLeaderError("Etcd is not responding properly")
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ class Postgresql:
|
||||
return False
|
||||
|
||||
def sync_from_leader(self, leader):
|
||||
r = parseurl(leader['address'])
|
||||
r = parseurl(leader.address)
|
||||
|
||||
pgpass = 'pgpass'
|
||||
with open(pgpass, 'w') as f:
|
||||
@@ -148,7 +148,7 @@ class Postgresql:
|
||||
member_cursor.execute(
|
||||
"SELECT %s - (pg_last_xlog_replay_location() - '0/0000000'::pg_lsn)", (self.xlog_position(), ))
|
||||
xlog_diff = member_cursor.fetchone()[0]
|
||||
logger.info([self.name, member['hostname'], xlog_diff])
|
||||
logger.info([self.name, member.hostname, xlog_diff])
|
||||
if xlog_diff < 0:
|
||||
member_cursor.close()
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user