From fd884a53a94c69c46ff1fd2fd96955726f58bff0 Mon Sep 17 00:00:00 2001 From: Oleksii Kliukin Date: Mon, 3 Aug 2015 15:51:40 +0200 Subject: [PATCH] Multiple small fixes: - Do delete trigger file in the patroni itself. - Fix the typo in the datadir member. - Add #! at the top of the python script. --- helpers/postgresql.py | 1 + scripts/restore.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) mode change 100644 => 100755 scripts/restore.py diff --git a/helpers/postgresql.py b/helpers/postgresql.py index 7a92d42c..7bb5b0ed 100644 --- a/helpers/postgresql.py +++ b/helpers/postgresql.py @@ -154,6 +154,7 @@ class Postgresql: cmd = self.config['restore'] ret = subprocess.call(shlex.split(os.path.abspath(cmd))+[self.scope, "replica", self.data_dir, connstring], env=env) + self.delete_trigger_file() return ret def is_leader(self, check_only=False): diff --git a/scripts/restore.py b/scripts/restore.py old mode 100644 new mode 100755 index 8dcb938c..3b95bc21 --- a/scripts/restore.py +++ b/scripts/restore.py @@ -1,3 +1,4 @@ +#!/usr/bin/python # arguments are: # - cluster scope # - cluster role @@ -17,7 +18,7 @@ class Restore: self.scope = scope self.role = role self.connstring = connstring - self.datadir = datadir + self.data_dir = datadir self.env = os.environ.copy() def parse_connstring(self): @@ -50,7 +51,6 @@ class Restore: ret = subprocess.call(['pg_basebackup', '-R', '-D', self.data_dir, '--host=' + master_connection['host'], '--port=' + str(master_connection['port']), '-U', master_connection['user']], env=self.env) - self.delete_trigger_file() return ret