mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Pass text names of cluster roles to the script.
Seems better than passing a bool flag and converting it from/to string.
This commit is contained in:
@@ -251,7 +251,7 @@ class Postgresql:
|
||||
logger.warning("unable to perform {0} action, cannot obtain the cluster role: {1}".format(cb_name, e))
|
||||
return False
|
||||
name = self.name
|
||||
subprocess.Popen(shlex.split(os.path.abspath(cmd))+[cb_name, is_leader, name])
|
||||
subprocess.Popen(shlex.split(os.path.abspath(cmd))+[cb_name, "master" if is_leader else "replica", name])
|
||||
return True
|
||||
|
||||
def start(self):
|
||||
|
||||
+2
-2
@@ -74,9 +74,9 @@ if __name__ == '__main__':
|
||||
if len(sys.argv) != 3:
|
||||
print ("Usage: {0} action role name".format(sys.argv[0]))
|
||||
return 1
|
||||
action, is_master, name = sys.argv[1:]
|
||||
action, role, name = sys.argv[1:]
|
||||
if action in ('on_start', 'on_stop', 'on_role_change'):
|
||||
aws = AWSConnection({'cluster_name': name})
|
||||
aws.on_role_change('master' if is_master else 'replica')
|
||||
aws.on_role_change(role)
|
||||
return 0
|
||||
return 2
|
||||
|
||||
Reference in New Issue
Block a user