Project

Profile

Help

Issue #4272

closed

ArtifactFileField's validation is too strict

Added by dkliban@redhat.com over 5 years ago. Updated over 4 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:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

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

Also available in: Atom PDF