From 38862840bf949da58bc18f820d64c73942dff8fe Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Wed, 22 Mar 2023 10:48:43 -0400 Subject: [PATCH] teuthology: do not compress tarballs when pulling dir Where we use this, it's for pulling log files that are already compressed. Do not waste time double compressing! Signed-off-by: Patrick Donnelly --- teuthology/misc.py | 4 ++-- teuthology/orchestra/remote.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/teuthology/misc.py b/teuthology/misc.py index 55b22b6fc..267630edd 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -745,8 +745,8 @@ def pull_directory(remote, remotedir, localdir, write_to=copy_fileobj): remote.shortname, remotedir, localdir) if not os.path.exists(localdir): os.mkdir(localdir) - r = remote.get_tar_stream(remotedir, sudo=True) - tar = tarfile.open(mode='r|gz', fileobj=r.stdout) + r = remote.get_tar_stream(remotedir, sudo=True, compress=False) + tar = tarfile.open(mode='r|', fileobj=r.stdout) while True: ti = tar.next() if ti is None: diff --git a/teuthology/orchestra/remote.py b/teuthology/orchestra/remote.py index 963f82da7..af5e139f7 100644 --- a/teuthology/orchestra/remote.py +++ b/teuthology/orchestra/remote.py @@ -622,7 +622,7 @@ class Remote(RemoteShell): self.remove(path) return local_path - def get_tar(self, path, to_path, sudo=False): + def get_tar(self, path, to_path, sudo=False, compress=True): """ Tar a remote directory and copy it locally """ @@ -632,7 +632,7 @@ class Remote(RemoteShell): args.append('sudo') args.extend([ 'tar', - 'cz', + 'cz' if compress else 'c', '-f', '-', '-C', path, '--', @@ -645,7 +645,7 @@ class Remote(RemoteShell): self._sftp_get_file(remote_temp_path, to_path) self.remove(remote_temp_path) - def get_tar_stream(self, path, sudo=False): + def get_tar_stream(self, path, sudo=False, compress=True): """ Tar-compress a remote directory and return the RemoteProcess for streaming @@ -655,7 +655,7 @@ class Remote(RemoteShell): args.append('sudo') args.extend([ 'tar', - 'cz', + 'cz' if compress else 'c', '-f', '-', '-C', path, '--', -- 2.47.3