diff --git a/pulpcore/app/tasks/upload.py b/pulpcore/app/tasks/upload.py
index 89d876816..dbd140f90 100644
--- a/pulpcore/app/tasks/upload.py
+++ b/pulpcore/app/tasks/upload.py
@@ -26,7 +26,7 @@ def commit(upload_id, sha256):
return
chunks = models.UploadChunk.objects.filter(upload=upload).order_by("offset")
- with NamedTemporaryFile("ab") as temp_file:
+ with NamedTemporaryFile(mode="ab", dir=".", delete=False) as temp_file:
for chunk in chunks:
temp_file.write(chunk.file.read())
temp_file.flush()
That patch got him as far as trying to create an RPM from a file but then pulp_rpm plugin complained about the file.
[dfurlong@snjlv-sysengutil01 ~]$ time /opt/systems/bin/syseng-pulpctlv3 --username=admin content-upload --type=rpm --platform=rhel7 --repo=acme --release=trunk --path=/home/dfurlong/acme-trino-363-1.el7.x86_64.rpm
2021-11-02 15:12:44|ERROR |Server: ncc1r8.us.acme.net, Task: /pulp/api/v3/tasks/452c9c7e-1715-4751-9462-0f68a649feb3/ is in a failed state. With message: RPM file cannot be parsed for metadata.
Traceback (most recent call last):
File "/opt/systems/bin/syseng-pulpctlv3", line 11, in <module>
controller.run()
File "/home/dfurlong/systems/syseng_code/python/site_syseng/prog/pulpctl/pulpctl.py", line 1107, in run
self.args.action(self)
File "/home/dfurlong/systems/syseng_code/python/site_syseng/prog/pulpctl/pulpctl.py", line 437, in <lambda>
content_upload_subparser.set_defaults(action=lambda s: cls.do_content_upload(s))
File "/home/dfurlong/systems/syseng_code/python/site_syseng/prog/pulpctl/pulpctl.py", line 1601, in do_content_upload
self.pulp3_servers.primary.content_create(artifacts, self.args.type)
File "/home/dfurlong/systems/syseng_code/python/site_syseng/prog/pulpctl/pulpserver.py", line 204, in content_create
href = self.tasks_retrieve_create_resource_7708(task_href=task, type=type)
File "/home/dfurlong/systems/syseng_code/python/site_syseng/prog/pulpctl/pulpserver.py", line 671, in tasks_retrieve_create_resource_7708
raise ValueError(
ValueError: ('task_href: %s, has failed with error %f', '/pulp/api/v3/tasks/452c9c7e-1715-4751-9462-0f68a649feb3/', {'traceback': ' File "/opt/acme/lib/python3.8/site-packages/pulpcore/tasking/pulpcore_worker.py", line 272, in _perform_task\n result = func(*args, **kwargs)\n File "/opt/acme/lib/python3.8/site-packages/pulpcore/app/tasks/base.py", line 34, in general_create\n serializer.is_valid(raise_exception=True)\n File "/opt/acme/lib/python3.8/site-packages/rest_framework/serializers.py", line 220, in is_valid\n self._validated_data = self.run_validation(self.initial_data)\n File "/opt/acme/lib/python3.8/site-packages/rest_framework/serializers.py", line 422, in run_validation\n value = self.validate(value)\n File "/opt/acme/lib/python3.8/site-packages/pulpcore/plugin/serializers/content.py", line 104, in validate\n data = self.deferred_validate(data)\n File "/opt/acme/lib/python3.8/site-packages/pulp_rpm/app/serializers/package.py", line 240, in deferred_validate\n raise NotAcceptable(detail="RPM file cannot be parsed for metadata.")\n', 'description': 'RPM file cannot be parsed for metadata.'})
Assembles chunked_uploads in workers working directory
fixes: #9550 https://pulp.plan.io/issues/9550