summaryrefslogtreecommitdiff
path: root/kvm.write
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-09-05 14:17:53 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-09-05 15:38:59 +0000
commit93d932f6a62e60357542e15f028551b7221c1720 (patch)
tree937d3d30b4865931adcfd4b814b7809827b5bfb2 /kvm.write
parent65ed235de623fd152dd2967b9ff2e1f60626c658 (diff)
downloaddefinitions-93d932f6a62e60357542e15f028551b7221c1720.tar.gz
Fix shell quoting for ssh remote command lines
Found by Richard Maw.
Diffstat (limited to 'kvm.write')
-rwxr-xr-xkvm.write8
1 files changed, 5 insertions, 3 deletions
diff --git a/kvm.write b/kvm.write
index 3e3b3eb1..16f188b5 100755
--- a/kvm.write
+++ b/kvm.write
@@ -94,11 +94,13 @@ class KvmPlusSshWriteExtension(morphlib.writeexts.WriteExtension):
xfer_hole_path = morphlib.util.get_data_path('xfer-hole')
recv_hole = morphlib.util.get_data('recv-hole')
+ ssh_remote_cmd = [
+ 'sh', '-c', recv_hole, 'dummy-argv0', 'file', vm_path
+ ]
+
cliapp.runcmd(
['python', xfer_hole_path, raw_disk],
- ['ssh', ssh_host,
- 'sh', '-c', cliapp.shell_quote(recv_hole),
- 'dummy-argv0', 'file', vm_path],
+ ['ssh', ssh_host] + map(cliapp.shell_quote, ssh_remote_cmd),
stdout=None, stderr=None)
def create_libvirt_guest(self, ssh_host, vm_name, vm_path, autostart):