mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Make sure params passed to the replica creation method are always defined. Per code review by Alex.
This commit is contained in:
@@ -258,6 +258,7 @@ class Postgresql:
|
||||
break
|
||||
else:
|
||||
cmd = replica_method
|
||||
method_config = {}
|
||||
# user-defined method; check for configuration
|
||||
# not required, actually
|
||||
if replica_method in self.config:
|
||||
@@ -266,17 +267,12 @@ class Postgresql:
|
||||
# if not, use the method name as the command
|
||||
cmd = method_config.pop('command', cmd)
|
||||
# add the default parameters
|
||||
try:
|
||||
method_config.update({"scope": self.scope,
|
||||
"role": "replica",
|
||||
"datadir": self.data_dir,
|
||||
"connstring": connstring})
|
||||
params = ["--{0}={1}".format(arg, val) for arg, val in method_config.items()]
|
||||
else:
|
||||
method_config = {"scope": self.scope,
|
||||
"role": "replica",
|
||||
"datadir": self.data_dir,
|
||||
"connstring": connstring}
|
||||
try:
|
||||
# call script with the full set of parameters
|
||||
ret = subprocess.call(shlex.split(cmd) + params, env=env)
|
||||
# if we succeeded, stop
|
||||
|
||||
Reference in New Issue
Block a user