From 01cf3671b454a29a25d115a697be8c22a45b17ee Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Mon, 5 May 2014 12:25:17 -0500 Subject: [PATCH] Fix linter errors Signed-off-by: Zack Cerza --- teuthology/orchestra/remote.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/teuthology/orchestra/remote.py b/teuthology/orchestra/remote.py index a72e40eb9e320..be69a3de0064c 100644 --- a/teuthology/orchestra/remote.py +++ b/teuthology/orchestra/remote.py @@ -111,15 +111,22 @@ class Remote(object): def mktemp(self): """ - Make a remote temporary file - + Make a remote temporary file + Returns: the name of the temp file created using tempfile.mkstemp """ + py_cmd = """ + import os; import tempfile; import sys; + (fd,fname) = tempfile.mkstemp(); + os.close(fd); + sys.stdout.write(fname.rstrip()); + sys.stdout.flush()' + """.replace('\n', ' ') args = [ 'python', '-c', - 'import os; import tempfile; import sys; (fd,fname) = tempfile.mkstemp(); os.close(fd); sys.stdout.write(fname.rstrip()); sys.stdout.flush()' + py_cmd, ] proc = self.run( args=args, @@ -159,9 +166,9 @@ class Remote(object): sftp.get(file_path, to_path) def remove(self, path): - self.run(args=['rm', '-fr', path]) + self.run(args=['rm', '-fr', path]) - def get_file(self, path, sudo=False): + def get_file(self, path, sudo=False): """ Read a file from the remote host into memory. """ @@ -176,7 +183,7 @@ class Remote(object): ] self.run(args=args) self.chmod(temp_file_path, '0666') - ret = self._sftp_get_file(temp_file_path) + ret = self._sftp_get_file(temp_file_path) self.remove(temp_file_path) return ret -- 2.39.5