Issue #4272
closedArtifactFileField's validation is too strict
Description
ArtifactFileField validates that the file being saved does not already exist in Artifact storage[0]. However, when bulk_get_or_create encounters a problem during bulk_create, it already moves the file into place before falling back to saving each model individually[1]. As a result, the validation logic from ArtifactFileField throws a ValueError because the file is already in Artifact storage, however it is still not saved to the database.
The validation should allow the file to be already in Artifact storage as long as it's being "saved" to the exact same location as it is at already.
[0] https://github.com/pulp/pulp/blob/master/pulpcore/app/models/fields.py#L31
[1] https://github.com/pulp/pulp/blob/master/pulpcore/app/models/content.py#L46
Added by mdellweg about 6 years ago
Added by mdellweg about 6 years ago
Revision a73e29d0 | View on GitHub
Do not fail if file already moved to storage
Updated by mdellweg about 6 years ago
- Status changed from NEW to MODIFIED
Applied in changeset pulp|a73e29d00e97fc4422edcc987b5a13f956038e54.
Updated by bmbouter about 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Do not fail if file already moved to storage
https://pulp.plan.io/issues/4272 closes #4272