Skip to content

RemoteOperations::exec_command explicitly transfers LANG, LANGUAGE and LC_* envvars to the server side #187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next Next commit
RemoteOperations::exec_command updated
- Exact enumeration of supported 'cmd' types
- Refactoring
  • Loading branch information
dmitry-lipetsk committed Feb 20, 2025
commit f5fe166eec93c2b727b4ee0145eecdf77d9b38d6
13 changes: 8 additions & 5 deletions testgres/operations/remote_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,17 @@ def exec_command(self, cmd, wait_exit=False, verbose=False, expect_error=False,

assert input_prepared is None or (type(input_prepared) == bytes) # noqa: E721

ssh_cmd = []
if isinstance(cmd, str):
ssh_cmd = ['ssh', self.ssh_dest] + self.ssh_args + [cmd]
elif isinstance(cmd, list):
ssh_cmd = ['ssh', self.ssh_dest] + self.ssh_args + [subprocess.list2cmdline(cmd)]
if type(cmd) == str: # noqa: E721
cmd_s = cmd
elif type(cmd) == list: # noqa: E721
cmd_s = subprocess.list2cmdline(cmd)
else:
raise ValueError("Invalid 'cmd' argument type - {0}".format(type(cmd).__name__))

assert type(cmd_s) == str # noqa: E721

ssh_cmd = ['ssh', self.ssh_dest] + self.ssh_args + [cmd_s]

process = subprocess.Popen(ssh_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
assert not (process is None)
if get_process:
Expand Down