@@ -707,7 +707,7 @@ def check_ptrack_clean(self, idx_dict, size):
707707 )
708708 )
709709
710- def run_pb (self ,command ,asynchronous = False ,gdb = False ,old_binary = False ,return_id = True ):
710+ def run_pb (self ,command ,asynchronous = False ,gdb = False ,old_binary = False ,return_id = True , env = None ):
711711if not self .probackup_old_path and old_binary :
712712print ('PGPROBACKUPBIN_OLD is not set' )
713713exit (1 )
@@ -717,6 +717,9 @@ def run_pb(self, command, asynchronous=False, gdb=False, old_binary=False, retur
717717else :
718718binary_path = self .probackup_path
719719
720+ if not env :
721+ env = self .test_env
722+
720723try :
721724self .cmd = [' ' .join (map (str , [binary_path ]+ command ))]
722725if self .verbose :
@@ -728,13 +731,13 @@ def run_pb(self, command, asynchronous=False, gdb=False, old_binary=False, retur
728731self .cmd ,
729732stdout = subprocess .PIPE ,
730733stderr = subprocess .PIPE ,
731- env = self . test_env
734+ env = env
732735 )
733736else :
734737self .output = subprocess .check_output (
735738 [binary_path ]+ command ,
736739stderr = subprocess .STDOUT ,
737- env = self . test_env
740+ env = env
738741 ).decode ('utf-8' )
739742if command [0 ]== 'backup' and return_id :
740743# return backup ID
@@ -845,7 +848,8 @@ def backup_node(
845848self ,backup_dir ,instance ,node ,data_dir = False ,
846849backup_type = 'full' ,datname = False ,options = [],
847850asynchronous = False ,gdb = False ,
848- old_binary = False ,return_id = True ,no_remote = False
851+ old_binary = False ,return_id = True ,no_remote = False ,
852+ env = None
849853 ):
850854if not node and not data_dir :
851855print ('You must provide ether node or data_dir for backup' )
@@ -878,7 +882,7 @@ def backup_node(
878882if not old_binary :
879883cmd_list += ['--no-sync' ]
880884
881- return self .run_pb (cmd_list + options ,asynchronous ,gdb ,old_binary ,return_id )
885+ return self .run_pb (cmd_list + options ,asynchronous ,gdb ,old_binary ,return_id , env = env )
882886
883887def checkdb_node (
884888self ,backup_dir = False ,instance = False ,data_dir = False ,
@@ -942,7 +946,8 @@ def restore_node(
942946
943947def show_pb (
944948self ,backup_dir ,instance = None ,backup_id = None ,
945- options = [],as_text = False ,as_json = True ,old_binary = False
949+ options = [],as_text = False ,as_json = True ,old_binary = False ,
950+ env = None
946951 ):
947952
948953backup_list = []
@@ -963,7 +968,7 @@ def show_pb(
963968
964969if as_text :
965970# You should print it when calling as_text=true
966- return self .run_pb (cmd_list + options ,old_binary = old_binary )
971+ return self .run_pb (cmd_list + options ,old_binary = old_binary , env = env )
967972
968973# get show result as list of lines
969974if as_json :
@@ -988,7 +993,7 @@ def show_pb(
988993return backup_list
989994else :
990995show_splitted = self .run_pb (
991- cmd_list + options ,old_binary = old_binary ).splitlines ()
996+ cmd_list + options ,old_binary = old_binary , env = env ).splitlines ()
992997if instance is not None and backup_id is None :
993998# cut header(ID, Mode, etc) from show as single string
994999header = show_splitted [1 :2 ][0 ]