From: Radek Pazdera rpazdera@redhat.com
There was a problem with scp commands that occured when a path containing a space was passed to any scp functions. This commit fixes that by enclosing paths within scp commands in single qoutes (').
Signed-off-by: Radek Pazdera rpazdera@redhat.com --- Common/SshUtils.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Common/SshUtils.py b/Common/SshUtils.py index e306976..340f119 100644 --- a/Common/SshUtils.py +++ b/Common/SshUtils.py @@ -362,7 +362,7 @@ def scp_to_remote(host, port, username, password, local_path, remote_path, @raise: Whatever remote_scp() raises """ command = ("scp -v -o UserKnownHostsFile=/dev/null " - " -r -P %s %s %s@%s:%s" % #-o PreferredAuthentications=password + " -r -P %s '%s' '%s@%s:%s'" % #-o PreferredAuthentications=password (port, local_path, username, host, remote_path)) password_list = [] password_list.append(password) @@ -386,7 +386,7 @@ def scp_from_remote(host, port, username, password, remote_path, local_path, @raise: Whatever remote_scp() raises """ command = ("scp -v -o UserKnownHostsFile=/dev/null " - "-o PreferredAuthentications=password -r -P %s %s@%s:%s %s" % + "-o PreferredAuthentications=password -r -P %s '%s@%s:%s' '%s'" % (port, username, host, remote_path, local_path)) password_list = [] password_list.append(password) @@ -411,7 +411,7 @@ def scp_between_remotes(src, dst, port, s_passwd, d_passwd, s_name, d_name, @return: True on success and False on failure. """ command = ("scp -v -o UserKnownHostsFile=/dev/null -o " - "PreferredAuthentications=password -r -P %s %s@%s:%s %s@%s:%s" % + "PreferredAuthentications=password -r -P %s '%s@%s:%s' '%s@%s:%s'" % (port, s_name, src, s_path, d_name, dst, d_path)) password_list = [] password_list.append(s_passwd)
All patches applied. Great work!
Jirka
Thu, Jun 21, 2012 at 12:15:42PM CEST, rpazdera@redhat.com wrote:
From: Radek Pazdera rpazdera@redhat.com
There was a problem with scp commands that occured when a path containing a space was passed to any scp functions. This commit fixes that by enclosing paths within scp commands in single qoutes (').
Signed-off-by: Radek Pazdera rpazdera@redhat.com
Common/SshUtils.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Common/SshUtils.py b/Common/SshUtils.py index e306976..340f119 100644 --- a/Common/SshUtils.py +++ b/Common/SshUtils.py @@ -362,7 +362,7 @@ def scp_to_remote(host, port, username, password, local_path, remote_path, @raise: Whatever remote_scp() raises """ command = ("scp -v -o UserKnownHostsFile=/dev/null "
" -r -P %s %s %s@%s:%s" % #-o PreferredAuthentications=password
password_list = [] password_list.append(password)" -r -P %s '%s' '%s@%s:%s'" % #-o PreferredAuthentications=password (port, local_path, username, host, remote_path))
@@ -386,7 +386,7 @@ def scp_from_remote(host, port, username, password, remote_path, local_path, @raise: Whatever remote_scp() raises """ command = ("scp -v -o UserKnownHostsFile=/dev/null "
"-o PreferredAuthentications=password -r -P %s %s@%s:%s %s" %
password_list = [] password_list.append(password)"-o PreferredAuthentications=password -r -P %s '%s@%s:%s' '%s'" % (port, username, host, remote_path, local_path))
@@ -411,7 +411,7 @@ def scp_between_remotes(src, dst, port, s_passwd, d_passwd, s_name, d_name, @return: True on success and False on failure. """ command = ("scp -v -o UserKnownHostsFile=/dev/null -o "
"PreferredAuthentications=password -r -P %s %s@%s:%s %s@%s:%s" %
password_list = [] password_list.append(s_passwd)"PreferredAuthentications=password -r -P %s '%s@%s:%s' '%s@%s:%s'" % (port, s_name, src, s_path, d_name, dst, d_path))
-- 1.7.7.6
LNST-developers mailing list LNST-developers@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/lnst-developers
lnst-developers@lists.fedorahosted.org