forgot space escaping in zfs_transfer()

This commit is contained in:
Edwin Eefting 2017-07-27 20:23:36 +02:00
parent 37b949fb8e
commit 8c121fab16

View File

@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf8 -*-
from __future__ import print_function
import os
import sys
@ -45,11 +48,9 @@ def run(cmd, input=None, ssh_to="local", tab_split=False, valid_exitcodes=[ 0 ],
#make sure the command gets all the data in utf8 format:
#(this is neccesary if LC_ALL=en_US.utf8 is not set in the environment)
encoded_cmd.append('"')
for arg in cmd:
#add single quotes for remote commands to support spaces and other wierd stuff (remote commands are executed in a shell)
encoded_cmd.append( ("'"+arg+"'").encode('utf-8'))
encoded_cmd.append('"')
else:
for arg in cmd:
@ -279,7 +280,10 @@ def zfs_transfer(ssh_source, source_filesystem, first_snapshot, second_snapshot,
if first_snapshot:
source_cmd.extend([ "-i", first_snapshot ])
source_cmd.append(source_filesystem + "@" + second_snapshot)
if ssh_source != "local":
source_cmd.append("'" + source_filesystem + "@" + second_snapshot + "'")
else:
source_cmd.append(source_filesystem + "@" + second_snapshot)
verbose(txt)
@ -303,7 +307,10 @@ def zfs_transfer(ssh_source, source_filesystem, first_snapshot, second_snapshot,
target_cmd.append("-s")
target_cmd.append(target_filesystem)
if ssh_target!="local":
target_cmd.append("'" + target_filesystem + "'")
else:
target_cmd.append(target_filesystem)