From 6d296b1b347415d81ad8cd143ab074663ba50f89 Mon Sep 17 00:00:00 2001 From: Oleksii Kliukin Date: Tue, 24 Nov 2015 16:26:08 +0100 Subject: [PATCH] Make sure params passed to the replica creation method are always defined. Per code review by Alex. --- patroni/postgresql.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/patroni/postgresql.py b/patroni/postgresql.py index b41d0fff..932634ed 100644 --- a/patroni/postgresql.py +++ b/patroni/postgresql.py @@ -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