Project

Profile

Help

Issue #4286

File content needs to support multiple artifacts

Added by amacdona@redhat.com almost 2 years ago. Updated almost 2 years ago.

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

Description

FileContent is only currently able to support a single Artifact. This seems correct, since each Content is associated with exactly 1 file.

However, the ContentArtifact table allows multiple associations between a single Content and Artifact if they have different relative_paths.

How to reproduce:
Note: I encountered this problem after stealing the `artifact` property from pulp_file for pulp_docker, so the reproducer steps are only theoretical. I'll try to reproduce for real tomorrow.

During file sync, the relative path is determined by the entry in the manifest file, but the Artifact is unique based on its digest. So presumably, if the same file is listed twice with different relative_paths, this problem would occur. The sync will succeed.

The failure will be visible when trying to view the content unit via the REST API, which will return a 500 error.

Note: rather than fake the url, I left the docker url, but it should be comparable.

MultipleObjectsReturned at /pulp/api/v3/content/docker/manifests/1342/
get() returned more than one Artifact -- it returned 3!

Looking at the database, the content was associated to same artifact 3 times, and each association has a different relative_path.

If this is actually a problem for pulp_file, I think the path forward is simply to remove the `artifact` property and adjust the serializer to return `artifacts` instead.

History

#1 Updated by amacdona@redhat.com almost 2 years ago

  • Status changed from NEW to CLOSED - NOTABUG

This isn't a problem. Since `relative_path` is an attribute on the FileContent model, there are no circumstances that an Artifact would need to be associated more than once.

Please register to edit this issue

Also available in: Atom PDF