mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Allow relative paths to external scripts.
This commit is contained in:
@@ -145,7 +145,7 @@ class Postgresql:
|
||||
|
||||
def create_replica(self, master_connection, env):
|
||||
connstring = self.build_connstring(master_connection)
|
||||
cmd = os.path.abspath(self.config['restore'])
|
||||
cmd = self.config['restore']
|
||||
try:
|
||||
ret = subprocess.call(shlex.split(cmd) + [self.scope, "replica", self.data_dir, connstring], env=env)
|
||||
self.delete_trigger_file()
|
||||
@@ -168,7 +168,7 @@ class Postgresql:
|
||||
""" pick a callback command and call it without waiting for it to finish """
|
||||
if not self.callback or cb_name not in self.callback:
|
||||
return False
|
||||
cmd = os.path.abspath(self.callback[cb_name])
|
||||
cmd = self.callback[cb_name]
|
||||
if is_leader is None:
|
||||
try:
|
||||
is_leader = self.is_leader(check_only=True)
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ postgresql:
|
||||
env_dir: /home/postgres/etc/wal-e.d/env
|
||||
threshold_megabytes: 10240
|
||||
threshold_backup_size_percentage: 30
|
||||
restore: /usr/bin/true
|
||||
restore: "true"
|
||||
#recovery_conf:
|
||||
#restore_command: cp ../wal_archive/%f %p
|
||||
parameters:
|
||||
|
||||
@@ -118,9 +118,9 @@ class TestPostgresql(unittest.TestCase):
|
||||
'password': 'rep-pass',
|
||||
'network': '127.0.0.1/32'},
|
||||
'parameters': {'foo': 'bar'}, 'recovery_conf': {'foo': 'bar'},
|
||||
'callbacks': {'on_start': '/usr/bin/true', 'on_stop': '/usr/bin/true',
|
||||
'on_restart': '/usr/bin/true', 'on_role_change': '/bin/true',
|
||||
'on_reload': '/usr/bin/true'
|
||||
'callbacks': {'on_start': 'true', 'on_stop': 'true',
|
||||
'on_restart': 'true', 'on_role_change': 'true',
|
||||
'on_reload': 'true'
|
||||
},
|
||||
'restore': '/usr/bin/true'})
|
||||
psycopg2.connect = psycopg2_connect
|
||||
|
||||
Reference in New Issue
Block a user