8989from .utils import \
9090 PgVer , \
9191 eprint , \
92- get_bin_path , \
92+ get_bin_path2 , \
9393 get_pg_version , \
94- execute_utility , \
94+ execute_utility2 , \
9595 options_string , \
9696 clean_on_error
9797
@@ -301,7 +301,7 @@ def base_dir(self):
301301 @property
302302 def bin_dir (self ):
303303 if not self ._bin_dir :
304- self ._bin_dir = os .path .dirname (get_bin_path ( "pg_config" ))
304+ self ._bin_dir = os .path .dirname (get_bin_path2 ( self . os_ops , "pg_config" ))
305305 return self ._bin_dir
306306
307307 @property
@@ -684,7 +684,7 @@ def status(self):
684684 "-D" , self .data_dir ,
685685 "status"
686686 ] # yapf: disable
687- status_code , out , error = execute_utility ( _params , self .utils_log_file , verbose = True )
687+ status_code , out , error = execute_utility2 ( self . os_ops , _params , self .utils_log_file , verbose = True )
688688 if error and 'does not exist' in error :
689689 return NodeStatus .Uninitialized
690690 elif 'no server running' in out :
@@ -710,7 +710,7 @@ def get_control_data(self):
710710 _params += ["-D" ] if self ._pg_version >= PgVer ('9.5' ) else []
711711 _params += [self .data_dir ]
712712
713- data = execute_utility ( _params , self .utils_log_file )
713+ data = execute_utility2 ( self . os_ops , _params , self .utils_log_file )
714714
715715 out_dict = {}
716716
@@ -793,7 +793,7 @@ def start(self, params=[], wait=True):
793793
794794 def LOCAL__start_node ():
795795 # 'error' will be None on Windows
796- _ , _ , error = execute_utility ( _params , self .utils_log_file , verbose = True )
796+ _ , _ , error = execute_utility2 ( self . os_ops , _params , self .utils_log_file , verbose = True )
797797 assert error is None or type (error ) == str # noqa: E721
798798 if error and 'does not exist' in error :
799799 raise Exception (error )
@@ -882,7 +882,7 @@ def stop(self, params=[], wait=True):
882882 "stop"
883883 ] + params # yapf: disable
884884
885- execute_utility ( _params , self .utils_log_file )
885+ execute_utility2 ( self . os_ops , _params , self .utils_log_file )
886886
887887 self ._maybe_stop_logger ()
888888 self .is_started = False
@@ -924,7 +924,7 @@ def restart(self, params=[]):
924924 ] + params # yapf: disable
925925
926926 try :
927- error_code , out , error = execute_utility ( _params , self .utils_log_file , verbose = True )
927+ error_code , out , error = execute_utility2 ( self . os_ops , _params , self .utils_log_file , verbose = True )
928928 if error and 'could not start server' in error :
929929 raise ExecUtilException
930930 except ExecUtilException as e :
@@ -953,7 +953,7 @@ def reload(self, params=[]):
953953 "reload"
954954 ] + params # yapf: disable
955955
956- execute_utility ( _params , self .utils_log_file )
956+ execute_utility2 ( self . os_ops , _params , self .utils_log_file )
957957
958958 return self
959959
@@ -975,7 +975,7 @@ def promote(self, dbname=None, username=None):
975975 "promote"
976976 ] # yapf: disable
977977
978- execute_utility ( _params , self .utils_log_file )
978+ execute_utility2 ( self . os_ops , _params , self .utils_log_file )
979979
980980 # for versions below 10 `promote` is asynchronous so we need to wait
981981 # until it actually becomes writable
@@ -1010,7 +1010,7 @@ def pg_ctl(self, params):
10101010 "-w" # wait
10111011 ] + params # yapf: disable
10121012
1013- return execute_utility ( _params , self .utils_log_file )
1013+ return execute_utility2 ( self . os_ops , _params , self .utils_log_file )
10141014
10151015 def free_port (self ):
10161016 """
@@ -1230,7 +1230,7 @@ def tmpfile():
12301230 "-F" , format .value
12311231 ] # yapf: disable
12321232
1233- execute_utility ( _params , self .utils_log_file )
1233+ execute_utility2 ( self . os_ops , _params , self .utils_log_file )
12341234
12351235 return filename
12361236
@@ -1259,7 +1259,7 @@ def restore(self, filename, dbname=None, username=None):
12591259
12601260 # try pg_restore if dump is binary format, and psql if not
12611261 try :
1262- execute_utility ( _params , self .utils_log_name )
1262+ execute_utility2 ( self . os_ops , _params , self .utils_log_name )
12631263 except ExecUtilException :
12641264 self .psql (filename = filename , dbname = dbname , username = username )
12651265
@@ -1612,7 +1612,7 @@ def pgbench_run(self, dbname=None, username=None, options=[], **kwargs):
16121612 # should be the last one
16131613 _params .append (dbname )
16141614
1615- return execute_utility ( _params , self .utils_log_file )
1615+ return execute_utility2 ( self . os_ops , _params , self .utils_log_file )
16161616
16171617 def connect (self ,
16181618 dbname = None ,
@@ -1809,7 +1809,7 @@ def _get_bin_path(self, filename):
18091809 if self .bin_dir :
18101810 bin_path = os .path .join (self .bin_dir , filename )
18111811 else :
1812- bin_path = get_bin_path ( filename )
1812+ bin_path = get_bin_path2 ( self . os_ops , filename )
18131813 return bin_path
18141814
18151815 def _escape_config_value (value ):
0 commit comments