Bugfix, hostname and address are not keys of dict but properties of Member object

This commit is contained in:
Alexander Kukushkin
2015-05-12 09:08:45 +02:00
parent e2faf641d5
commit be7677a1b8
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -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")
+2 -2
View File
@@ -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