From: Michael Qiu <michael.qiu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH 2/2] framework/ssh: Add destination available for file copy function
Date: Wed, 11 Feb 2015 20:26:25 +0800 [thread overview]
Message-ID: <1423657585-13429-1-git-send-email-michael.qiu@intel.com> (raw)
For file copy in ssh module, the destination is fixed.
This patch make it configurable.
Signed-off-by: Michael Qiu <michael.qiu@intel.com>
---
framework/ssh_connection.py | 8 ++++----
framework/ssh_pexpect.py | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/framework/ssh_connection.py b/framework/ssh_connection.py
index 25f249a..f86b3b5 100644
--- a/framework/ssh_connection.py
+++ b/framework/ssh_connection.py
@@ -61,8 +61,8 @@ class SSHConnection(object):
def isalive(self):
return self.session.isalive()
- def copy_file_from(self, filename, password=''):
- self.session.copy_file_from(filename, password)
+ def copy_file_from(self, src, dst = ".", password=''):
+ self.session.copy_file_from(src, dst, password)
- def copy_file_to(self, filename, password=''):
- self.session.copy_file_to(filename, password)
+ def copy_file_to(self, src, dst = "~/", password=''):
+ self.session.copy_file_to(src, dst, password)
diff --git a/framework/ssh_pexpect.py b/framework/ssh_pexpect.py
index 9c353e7..8f8c982 100644
--- a/framework/ssh_pexpect.py
+++ b/framework/ssh_pexpect.py
@@ -66,21 +66,21 @@ class SSHPexpect(object):
def isalive(self):
return self.session.isalive()
- def copy_file_from(self, filename, password=''):
+ def copy_file_from(self, src, dst = ".", password=''):
"""
Copies a file from a remote place into local.
"""
- command = 'scp {0}@{1}:{2} .'.format(self.username, self.host, filename)
+ command = 'scp {0}@{1}:{2} {3}'.format(self.username, self.host, src, dst)
if password == '':
self._spawn_scp(command, self.password)
else:
self._spawn_scp(command, password)
- def copy_file_to(self, filename, password=''):
+ def copy_file_to(self, src, dst = "~/", password=''):
"""
Sends a local file to a remote place.
"""
- command = 'scp {0} {1}@{2}:'.format(filename, self.username, self.host)
+ command = 'scp {0} {1}@{2}:{3}'.format(src, self.username, self.host, dst)
if password == '':
self._spawn_scp(command, self.password)
else:
--
1.9.3
next reply other threads:[~2015-02-11 12:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-11 12:26 Michael Qiu [this message]
2015-02-12 1:25 ` Liu, Yong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1423657585-13429-1-git-send-email-michael.qiu@intel.com \
--to=michael.qiu@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).