Permalink
Browse files

Fix the Rsync Tasks' Path Checker' and 'Run Now' to handle spaces in …

…path names.

This fixes:
Ticket: #7350 (The Rsync feature doesn't work as it should do.)
  • Loading branch information...
Suraj Ravichandran
Suraj Ravichandran committed Jan 15, 2015
1 parent 77a539b commit 90c6ae3a653f7ed7ce42a8249b691347f791c033
Showing with 10 additions and 10 deletions.
  1. +2 −2 gui/tasks/forms.py
  2. +8 −8 gui/tasks/models.py
@@ -200,8 +200,8 @@ def check_rpath_exists(self):
rport = str(self.cleaned_data.get("rsync_remoteport"))
rpath = self.cleaned_data.get("rsync_remotepath").encode('utf8')
proc = subprocess.Popen(
"""su -m %s -c "ssh -p %s -o 'BatchMode yes' -o 'ConnectTimeout=5' %s test -d %s" """
% (ruser, rport, remote, rpath), shell=True)
"""su -m %s -c 'ssh -p %s -o "BatchMode yes" -o "ConnectTimeout=5" %s test -d \\""%s"\\"' """
% (ruser, rport, remote, rpath), shell=True)
proc.wait()
return proc.returncode == 0
@@ -482,7 +482,7 @@ def get_human_dayweek(self):
return ', '.join(labels)
def commandline(self):
line = '/usr/bin/lockf -s -t 0 -k \'%s\' /usr/local/bin/rsync' % (
line = '/usr/bin/lockf -s -t 0 -k "%s" /usr/local/bin/rsync' % (
self.rsync_path
)
if self.rsync_recursive:
@@ -513,32 +513,32 @@ def commandline(self):
if self.rsync_mode == 'module':
if self.rsync_direction == 'push':
line += ' \'%s\' %s::%s' % (
line += ' "%s" %s::%s' % (
self.rsync_path,
remote,
self.rsync_remotemodule,
)
else:
line += ' %s::%s \'%s\'' % (
line += ' %s::%s "%s"' % (
remote,
self.rsync_remotemodule,
self.rsync_path,
)
else:
line += (
' -e \'ssh -p %d -o BatchMode=yes '
'-o StrictHostKeyChecking=yes\''
' -e "ssh -p %d -o BatchMode=yes '
'-o StrictHostKeyChecking=yes"'
) % (
self.rsync_remoteport
)
if self.rsync_direction == 'push':
line += ' \'%s\' %s:\'%s\'' % (
line += ' "%s" %s:\\""%s"\\"' % (
self.rsync_path,
remote,
self.rsync_remotepath,
)
else:
line += ' %s:\'%s\' \'%s\'' % (
line += ' %s:\\""%s"\\" "%s"' % (
remote,
self.rsync_remotepath,
self.rsync_path,
@@ -549,7 +549,7 @@ def commandline(self):
def run(self):
subprocess.Popen(
'su -m %s -c "%s" 2>&1 | logger -t rsync' % (
'su -m %s -c \'%s\' 2>&1 | logger -t rsync' % (
self.rsync_user,
self.commandline(),
),

0 comments on commit 90c6ae3

Please sign in to comment.