From 05615d6487100372565f950c9a63a61ab16d211d Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Mon, 2 Mar 2020 13:06:08 +0100 Subject: [PATCH] Split command lines using shlex module This also enable SSH compression by default Change-Id: Ifc9449b7724f3e8bd7e15eab6e6a0f77d7be1840 --- tobiko/shell/sh/_command.py | 3 ++- tobiko/shell/ssh/config.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tobiko/shell/sh/_command.py b/tobiko/shell/sh/_command.py index 8f08e742c..e48ae63fb 100644 --- a/tobiko/shell/sh/_command.py +++ b/tobiko/shell/sh/_command.py @@ -16,6 +16,7 @@ from __future__ import absolute_import import subprocess +import shlex import six @@ -24,7 +25,7 @@ def shell_command(command): if isinstance(command, ShellCommand): return command elif isinstance(command, six.string_types): - return ShellCommand(command.split()) + return ShellCommand(shlex.split(command, comments=True, posix=True)) elif command: return ShellCommand(str(a) for a in command) else: diff --git a/tobiko/shell/ssh/config.py b/tobiko/shell/ssh/config.py index 1c08d13f1..a73974a46 100644 --- a/tobiko/shell/ssh/config.py +++ b/tobiko/shell/ssh/config.py @@ -45,7 +45,7 @@ OPTIONS = [ help=("Set to False to disable connecting to the " "SSH agent")), cfg.BoolOpt('compress', - default=False, + default=True, help="Set to True to turn on compression"), cfg.FloatOpt('timeout', default=10.,