test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH 2/2] framework/ssh: Add destination available for file copy function
@ 2015-02-11 12:26 Michael Qiu
  2015-02-12  1:25 ` Liu, Yong
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Qiu @ 2015-02-11 12:26 UTC (permalink / raw)
  To: dts

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-12  1:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-11 12:26 [dts] [PATCH 2/2] framework/ssh: Add destination available for file copy function Michael Qiu
2015-02-12  1:25 ` Liu, Yong

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).