Revision 72f0f7fd

b/lib/backend.py
1022 1022

  
1023 1023
  comprcmd = "gzip"
1024 1024

  
1025
  destcmd = utils.BuildShellCmd("mkdir -p %s; cat > %s/%s", 
1025
  destcmd = utils.BuildShellCmd("mkdir -p %s && cat > %s/%s",
1026 1026
                                destdir, destdir, destfile)
1027 1027
  remotecmd = ssh.BuildSSHCmd(dest_node, 'root', destcmd)
1028
  
1029
  
1028

  
1029

  
1030 1030

  
1031 1031
  # all commands have been checked, so we're safe to combine them
1032
  command = '|'.join([expcmd, comprcmd, ' '.join(remotecmd)])
1032
  command = '|'.join([expcmd, comprcmd, utils.ShellQuoteArgs(remotecmd)])
1033 1033

  
1034 1034
  result = utils.RunCmd(command)
1035 1035

  
......
1178 1178
                               real_os_dev.dev_path, real_swap_dev.dev_path,
1179 1179
                               logfile)
1180 1180

  
1181
  command = '|'.join([' '.join(remotecmd), comprcmd, impcmd])
1181
  command = '|'.join([utils.ShellQuoteArgs(remotecmd), comprcmd, impcmd])
1182 1182

  
1183 1183
  result = utils.RunCmd(command)
1184 1184

  
b/lib/ssh.py
54 54
  "-oHashKnownHosts=no",
55 55
  ]
56 56

  
57

  
57 58
def BuildSSHCmd(hostname, user, command, batch=True, ask_key=False):
58 59
  """Build an ssh string to execute a command on a remote node.
59 60

  
......
78 79
    argv.extend(BATCH_MODE_OPTS)
79 80
  elif ask_key:
80 81
    argv.extend(ASK_KEY_OPTS)
81
  argv.extend(["%s@%s" % (user, hostname), "'%s'" % command])
82
  argv.extend(["%s@%s" % (user, hostname), command])
82 83
  return argv
83 84

  
84 85

  

Also available in: Unified diff