Avoid creating a temporary file either on the remote or on the
local host; just open a connection to a remote tar and let 'er
rip. Intended to be used by get_directory to avoid temp files
and local read/write hammering.
Signed-off-by: Dan Mick <dan.mick@redhat.com>
self._sftp_get_file(remote_temp_path, to_path)
self.remove(remote_temp_path)
+ def get_tar_stream(self, path, sudo=False):
+ """
+ Tar-compress a remote directory and return the RemoteProcess
+ for streaming
+ """
+ args = []
+ if sudo:
+ args.append('sudo')
+ args.extend([
+ 'tar',
+ 'cz',
+ '-f', '-',
+ '-C', path,
+ '--',
+ '.',
+ ])
+ return self.run(args=args, wait=False, stdout=run.PIPE)
+
@property
def os(self):
if not hasattr(self, '_os'):