From 22138109cc622e58e84213fce9d8095e1cbaef12 Mon Sep 17 00:00:00 2001 From: Daniel Alley Date: Fri, 8 Apr 2022 00:06:33 -0400 Subject: [PATCH] Fix not using the worker working directory closes #696 (cherry picked from commit 8fcb1f0a051303e89a32224ddd74f4e0770abc52) --- CHANGES/696.bugfix | 1 + pulp_container/app/tasks/builder.py | 2 +- pulp_container/app/tasks/sign.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 CHANGES/696.bugfix diff --git a/CHANGES/696.bugfix b/CHANGES/696.bugfix new file mode 100644 index 000000000..a8383d8ed --- /dev/null +++ b/CHANGES/696.bugfix @@ -0,0 +1 @@ +Fixed some tasks that were using /tmp/ instead of the worker working directory. diff --git a/pulp_container/app/tasks/builder.py b/pulp_container/app/tasks/builder.py index 344d5c680..9509d8bb3 100644 --- a/pulp_container/app/tasks/builder.py +++ b/pulp_container/app/tasks/builder.py @@ -113,7 +113,7 @@ def build_image_from_containerfile( containerfile = Artifact.objects.get(pk=containerfile_pk) repository = ContainerRepository.objects.get(pk=repository_pk) name = str(uuid4()) - with tempfile.TemporaryDirectory(".") as working_directory: + with tempfile.TemporaryDirectory(dir=".") as working_directory: path = "{}/".format(working_directory.path) for key, val in artifacts.items(): artifact = Artifact.objects.get(pk=key) diff --git a/pulp_container/app/tasks/sign.py b/pulp_container/app/tasks/sign.py index 2ea422f7f..926b394c8 100644 --- a/pulp_container/app/tasks/sign.py +++ b/pulp_container/app/tasks/sign.py @@ -89,7 +89,7 @@ def create_signature(manifest, reference, signing_service): pk of created ManifestSignature. """ - with tempfile.TemporaryDirectory(".") as working_directory: + with tempfile.TemporaryDirectory(dir=".") as working_directory: # download and write file for object storage if settings.DEFAULT_FILE_STORAGE != "pulpcore.app.models.storage.FileSystem": manifest_file = tempfile.NamedTemporaryFile(dir=working_directory, delete=False)