]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
FIx mktemp dir and redundant Paramiko connecting.
authorWarren Usui <warren.usui@inktank.com>
Thu, 1 May 2014 19:52:45 +0000 (12:52 -0700)
committerZack Cerza <zack@cerza.org>
Tue, 6 May 2014 19:59:52 +0000 (14:59 -0500)
Use previously initialized connection for sftp_get calls.
Use local directory for tarball temp file location.

teuthology/misc.py
teuthology/orchestra/remote.py

index bef136429af10bb41f56a3c40fa5f7cd3579b6d1..afe58e0129d30c7127b40dde4995e39abaaa6aca 100644 (file)
@@ -625,7 +625,7 @@ def pull_directory(remote, remotedir, localdir):
               remote.shortname, remotedir, localdir)
     if not os.path.exists(localdir):
         os.mkdir(localdir)
-    _, local_tarfile = tempfile.mkstemp()
+    _, local_tarfile = tempfile.mkstemp(dir=localdir)
     remote.get_tar(remotedir, local_tarfile, sudo=True)
     with open(local_tarfile, 'r+') as fb1:
         tar = tarfile.open(mode='r|', fileobj=fb1)
index 5e8be0c843c6182e1d16029fddc9342f0b9cc0b1..a72e40eb9e32014be9e96dcce5d90c2e55e1963f 100644 (file)
@@ -73,10 +73,6 @@ class Remote(object):
     def hostname(self):
         return self.name.split('@')[1]
 
-    @property
-    def username(self):
-        return self.name.split('@')[0]
-
     @property
     def is_online(self):
         if self.ssh is None:
@@ -159,11 +155,7 @@ class Remote(object):
         return result
 
     def _sftp_copy_file(self, file_path, to_path):
-        client = paramiko.SSHClient()
-        client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
-        client.load_system_host_keys()
-        client.connect(self.hostname, username=self.username)
-        sftp = client.open_sftp()
+        sftp = self.ssh.open_sftp()
         sftp.get(file_path, to_path)
 
     def remove(self, path):