Skip to content

Commit 00f7fd5

Browse files
committed
Fix the arg variable name
1 parent 6b4619e commit 00f7fd5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

testgres/operations/remote_ops.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ def __init__(self, conn_params: ConnectionParams):
4646
self.host = conn_params.host
4747
self.ssh_key = conn_params.ssh_key
4848
if self.ssh_key:
49-
self.ssh_cmd = ["-i", self.ssh_key]
49+
self.ssh_args = ["-i", self.ssh_key]
5050
else:
51-
self.ssh_cmd = []
51+
self.ssh_args = []
5252
self.remote = True
5353
self.username = conn_params.username
5454
self.ssh_dest = f"{self.username}@{self.host}" if self.username else self.host
@@ -96,9 +96,9 @@ def exec_command(self, cmd, wait_exit=False, verbose=False, expect_error=False,
9696
"""
9797
ssh_cmd = []
9898
if isinstance(cmd, str):
99-
ssh_cmd = ['ssh', self.ssh_dest] + self.ssh_cmd + [cmd]
99+
ssh_cmd = ['ssh'] + self.ssh_args + [self.ssh_dest + cmd]
100100
elif isinstance(cmd, list):
101-
ssh_cmd = ['ssh', self.ssh_dest] + self.ssh_cmd + cmd
101+
ssh_cmd = ['ssh'] + self.ssh_args + [self.ssh_dest] + cmd
102102
process = subprocess.Popen(ssh_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
103103
if get_process:
104104
return process
@@ -243,9 +243,9 @@ def mkdtemp(self, prefix=None):
243243
- prefix (str): The prefix of the temporary directory name.
244244
"""
245245
if prefix:
246-
command = ["ssh"] + self.ssh_cmd + [self.ssh_dest, f"mktemp -d {prefix}XXXXX"]
246+
command = ["ssh"] + self.ssh_args + [self.ssh_dest, f"mktemp -d {prefix}XXXXX"]
247247
else:
248-
command = ["ssh"] + self.ssh_cmd + [self.ssh_dest, "mktemp -d"]
248+
command = ["ssh"] + self.ssh_args + [self.ssh_dest, "mktemp -d"]
249249

250250
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
251251

@@ -289,7 +289,7 @@ def write(self, filename, data, truncate=False, binary=False, read_and_write=Fal
289289

290290
with tempfile.NamedTemporaryFile(mode=mode, delete=False) as tmp_file:
291291
if not truncate:
292-
scp_cmd = ['scp'] + self.ssh_cmd + [f"{self.ssh_dest}:{filename}", tmp_file.name]
292+
scp_cmd = ['scp'] + self.ssh_args + [f"{self.ssh_dest}:{filename}", tmp_file.name]
293293
subprocess.run(scp_cmd, check=False) # The file might not exist yet
294294
tmp_file.seek(0, os.SEEK_END)
295295

@@ -305,11 +305,11 @@ def write(self, filename, data, truncate=False, binary=False, read_and_write=Fal
305305
tmp_file.write(data)
306306

307307
tmp_file.flush()
308-
scp_cmd = ['scp'] + self.ssh_cmd + [tmp_file.name, f"{self.ssh_dest}:{filename}"]
308+
scp_cmd = ['scp'] + self.ssh_args + [tmp_file.name, f"{self.ssh_dest}:{filename}"]
309309
subprocess.run(scp_cmd, check=True)
310310

311311
remote_directory = os.path.dirname(filename)
312-
mkdir_cmd = ['ssh'] + self.ssh_cmd + [self.ssh_dest, f"mkdir -p {remote_directory}"]
312+
mkdir_cmd = ['ssh'] + self.ssh_args + [self.ssh_dest, f"mkdir -p {remote_directory}"]
313313
subprocess.run(mkdir_cmd, check=True)
314314

315315
os.remove(tmp_file.name)
@@ -374,7 +374,7 @@ def get_pid(self):
374374
return int(self.exec_command("echo $$", encoding=get_default_encoding()))
375375

376376
def get_process_children(self, pid):
377-
command = ["ssh"] + self.ssh_cmd + [self.ssh_dest, f"pgrep -P {pid}"]
377+
command = ["ssh"] + self.ssh_args + [self.ssh_dest, f"pgrep -P {pid}"]
378378

379379
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
380380

0 commit comments

Comments
 (0)