mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Autodetect the host role during start from the existence of recovery.conf. Fix some typos.
This commit is contained in:
@@ -44,14 +44,12 @@ class Governor:
|
||||
self.postgresql.start()
|
||||
self.postgresql.create_replication_user()
|
||||
self.postgresql.create_connection_users()
|
||||
self.aws.on_role_change('master')
|
||||
else:
|
||||
while True:
|
||||
leader = self.etcd.current_leader()
|
||||
if leader and self.postgresql.sync_from_leader(leader):
|
||||
self.postgresql.write_recovery_conf(leader)
|
||||
self.postgresql.start()
|
||||
self.aws.on_role_change('replica')
|
||||
break
|
||||
sleep(5)
|
||||
elif self.postgresql.is_running():
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ class AWSConnection:
|
||||
try:
|
||||
conn = boto.ec2.connect_to_region(self.region)
|
||||
# get all volumes attached to the current instance
|
||||
volumes = conn.get_all_volumes(filter={'attachment.instance-id': self.instance_id})
|
||||
volumes = conn.get_all_volumes(filters={'attachment.instance-id': self.instance_id})
|
||||
if volumes:
|
||||
conn.create_tags([v.id for v in volumes], tags)
|
||||
except Exception as e:
|
||||
@@ -64,7 +64,7 @@ class AWSConnection:
|
||||
conn = boto.ec2.connect_to_region(self.region)
|
||||
instances = conn.get_all_reservations(instance_ids=[self.instance_id])
|
||||
if instances:
|
||||
conn.create_tag([instances[0].id], tags)
|
||||
conn.create_tags([instances[0].id], tags)
|
||||
except Exception as e:
|
||||
logger.info("could not set tags for EC2 instance {}: {}".format(self.instance_id, e))
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user