9494
9595from .backup import NodeBackup
9696
97+ from .operations .os_ops import ConnectionParams
9798from .operations .local_ops import LocalOperations
9899from .operations .remote_ops import RemoteOperations
99100
@@ -125,8 +126,7 @@ def __repr__(self):
125126
126127
127128class PostgresNode (object ):
128- def __init__ (self ,name = None ,port = None ,base_dir = None ,
129- host = '127.0.0.1' ,hostname = 'localhost' ,ssh_key = None ,username = default_username (),os_ops = None ):
129+ def __init__ (self ,name = None ,port = None ,base_dir = None ,conn_params :ConnectionParams = ConnectionParams ()):
130130"""
131131 PostgresNode constructor.
132132
@@ -146,17 +146,14 @@ def __init__(self, name=None, port=None, base_dir=None,
146146# basic
147147self .name = name or generate_app_name ()
148148
149- if os_ops :
150- self .os_ops = os_ops
151- elif ssh_key :
152- self .os_ops = RemoteOperations (host = host ,hostname = hostname ,ssh_key = ssh_key ,username = username )
149+ if conn_params .ssh_key :
150+ self .os_ops = RemoteOperations (conn_params )
153151else :
154- self .os_ops = LocalOperations (host = host , hostname = hostname , username = username )
152+ self .os_ops = LocalOperations (conn_params )
155153
156- self .port = self . os_ops . port or reserve_port ()
154+ self .port = port or reserve_port ()
157155
158156self .host = self .os_ops .host
159- self .hostname = self .os_ops .hostname
160157self .ssh_key = self .os_ops .ssh_key
161158
162159testgres_config .os_ops = self .os_ops
@@ -628,7 +625,7 @@ def status(self):
628625status_code ,out ,err = execute_utility (_params ,self .utils_log_file ,verbose = True )
629626if 'does not exist' in err :
630627return NodeStatus .Uninitialized
631- elif 'no server running' in out :
628+ elif 'no server running' in out :
632629return NodeStatus .Stopped
633630return NodeStatus .Running
634631