aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/ssh.py
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-08-23 17:05:56 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-08-23 17:05:56 +0000
commit44d2cbdc16b543980d95e0d49456d48868d088d7 (patch)
treef9acc8f8986820fb8e6427b289e08e45ace60089 /yardstick/ssh.py
parentf71c4a0694365b846146f2957c26c4f071413ace (diff)
parentbb3ad3827f02bb27bcc84e191afc27ddd2da38b2 (diff)
Merge "ssh: add new get_file_obj method to fetch remote files"
Diffstat (limited to 'yardstick/ssh.py')
-rw-r--r--yardstick/ssh.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/yardstick/ssh.py b/yardstick/ssh.py
index 8ac3eaa3a..a024cf64a 100644
--- a/yardstick/ssh.py
+++ b/yardstick/ssh.py
@@ -423,6 +423,12 @@ class SSH(object):
if mode is not None:
sftp.chmod(remotepath, mode)
+ def get_file_obj(self, remotepath, file_obj):
+ client = self._get_client()
+
+ with client.open_sftp() as sftp:
+ sftp.getfo(remotepath, file_obj)
+
class AutoConnectSSH(SSH):
@@ -471,6 +477,10 @@ class AutoConnectSSH(SSH):
self._connect()
return super(AutoConnectSSH, self).put_file_obj(file_obj, remote_path, mode)
+ def get_file_obj(self, remote_path, file_obj):
+ self._connect()
+ return super(AutoConnectSSH, self).get_file_obj(remote_path, file_obj)
+
def provision_tool(self, tool_path, tool_file=None):
self._connect()
return super(AutoConnectSSH, self).provision_tool(tool_path, tool_file)