Project

Profile

Help

Story #6749

Updated by daviddavis over 4 years ago

## Current Problems 

 1. Deleting the temporary Artifact can cause a race condition where the second fails or no deletes occur 
 2. FK exception when the Artifact being deleted already exists and is associated with other content 
 3. Backups would incorrectly include both long-term Artifacts and short-term files. 
 4. Security concern that these temporary files are exposed to users as Artifacts and can be associated to Content, etc 


 ## Background 

 Sometimes, files must be brought forward from the viewset to the executing task, that are not meant to end up being artifacts in the end. On the other hand, different pulp services are not guaranteed to share a common filesystem (like `/usr/share/pulp`). 

 ## Proposal 

 The design is to have a service that allows to create files with the same storage technology that the artifacts use, where unique names are generated, and the task to use the file has the duty to remove it again from the storage. 
 It is necessary, that those files do neither collide with any artifact that happens to be identical, nor another such file created for a different task. 

 ## The Plan 

 1. Create a new model called `PulpTemporaryFile` that has a `pulp_id` and a `file`. 
 2. This should be a copy of the code in `Artifact` except it should not have uniqueness constraint 
 3. Files should be saved based on pulp_id (eg `MEDIA_ROOT/tmp/files/29/beb7f3-1a70-40da-86fc-5f9006670baa`)

Back