diff --git a/asu/common.py b/asu/common.py index 73e51c25..fa842908 100644 --- a/asu/common.py +++ b/asu/common.py @@ -8,6 +8,7 @@ from pathlib import Path from re import match from shutil import unpack_archive +from tarfile import TarFile from tempfile import NamedTemporaryFile import nacl.signing @@ -286,25 +287,17 @@ def run_container( logging.debug(f"Container tar: {container_tar}") host_tar = NamedTemporaryFile(delete=True) - logging.debug(f"Host tar: {host_tar}") + logging.debug(f"Copying {container_tar} to {host_tar}") - host_tar.write(b"".join(container_tar)) + for data in container_tar: + host_tar.write(data) + host_tar.flush() - logging.debug(f"Copied {container_tar} to {host_tar}") - - # check if the tar is empty - if host_tar.tell(): - unpack_archive( - host_tar.name, - copy[1], - "tar", - ) - logging.debug(f"Unpacked {host_tar} to {copy[1]}") - else: - logging.warning(f"Empty tar: {host_tar}") - returncode = 1 + tar_file = TarFile(host_tar.name) + tar_file.extractall(copy[1]) host_tar.close() + logging.debug(f"Closed {host_tar}") try: diff --git a/pyproject.toml b/pyproject.toml index 10ab5f8c..66296814 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,7 @@ prometheus-client = ">=0.13.1,<0.21.0" gunicorn = ">=20.1,<22.0" podman = ">=4.4.1,<6.0.0" setuptools = "^69.0.3" +boto3 = "^1.34.75" [tool.poetry.group.dev.dependencies] ruff = ">=0.2.2,<0.4.0"