Project

Profile

Help

Issue #7319

closed

PulpTemporaryFile aren't being stored in /var/lib/pulp

Added by daviddavis over 3 years ago. Updated over 3 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 80
Quarter:

Description

We intended for these files to be stored in /var/lib/pulp[0].

In [1]: import tempfile                                                                                               

In [2]: with tempfile.NamedTemporaryFile("ab") as tf: 
   ...:     temp_file = PulpTemporaryFile(file=tf.name) 
   ...:     temp_file.save() 
   ...:                                                                                                               

In [3]: PulpTemporaryFile.objects.all()                                                                               
Out[3]: <QuerySet [<PulpTemporaryFile: pk=db5b57ba-1f65-4f0c-85b5-6d01c84b7d77>]>

In [4]: PulpTemporaryFile.objects.all()[0].file                                                                       
Out[4]: <FieldFile: /tmp/tmp7ttftw60>

In [5]: PulpTemporaryFile.objects.all()[0].file.read()
OSError: File does not exist: tmp/tmp7ttftw60

I think if we use ArtifactFileField[1], it should resolve this problem.

[0] https://github.com/pulp/pulpcore/blob/0f30cfefdfedc53cf79dc6ce9d12ff9e33351e96/pulpcore/app/models/content.py#L290-L298 [1] https://github.com/pulp/pulpcore/blob/b94abd64d76ea4554e6750ff38ce458eaa888cc8/pulpcore/app/models/fields.py#L11

Also available in: Atom PDF