diff --git a/testgres/node.py b/testgres/node.py index f7d6e839..3d023399 100644 --- a/testgres/node.py +++ b/testgres/node.py @@ -1125,10 +1125,7 @@ def _psql( # select query source if query: - if self.os_ops.remote: - psql_params.extend(("-c", '"{}"'.format(query))) - else: - psql_params.extend(("-c", query)) + psql_params.extend(("-c", query)) elif filename: psql_params.extend(("-f", filename)) else: diff --git a/testgres/operations/remote_ops.py b/testgres/operations/remote_ops.py index 3aa2d8c4..fb5dd4b2 100644 --- a/testgres/operations/remote_ops.py +++ b/testgres/operations/remote_ops.py @@ -80,7 +80,10 @@ def exec_command(self, cmd, wait_exit=False, verbose=False, expect_error=False, 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 + cmd + ssh_cmd = ['ssh', self.ssh_dest] + self.ssh_args + [subprocess.list2cmdline(cmd)] + else: + raise ValueError("Invalid 'cmd' argument type - {0}".format(type(cmd).__name__)) + process = subprocess.Popen(ssh_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) assert not (process is None) if get_process: