From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id DB10A9A8D for ; Wed, 11 Feb 2015 13:26:34 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 11 Feb 2015 04:22:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,558,1418112000"; d="scan'208";a="525926048" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 11 Feb 2015 04:18:24 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t1BCQUAc030340; Wed, 11 Feb 2015 20:26:30 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t1BCQQCD013465; Wed, 11 Feb 2015 20:26:28 +0800 Received: (from dayuqiu@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t1BCQQHH013461; Wed, 11 Feb 2015 20:26:26 +0800 From: Michael Qiu To: dts@dpdk.org Date: Wed, 11 Feb 2015 20:26:25 +0800 Message-Id: <1423657585-13429-1-git-send-email-michael.qiu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dts] [PATCH 2/2] framework/ssh: Add destination available for file copy function X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Feb 2015 12:26:35 -0000 For file copy in ssh module, the destination is fixed. This patch make it configurable. Signed-off-by: Michael Qiu --- 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