File content needs to support multiple artifacts
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.
Please register to edit this issue