Create Serializers and Viewsets for Content #291
Conversation
|
Added WIP so I remember to add all the help_texts |
5c2e903
to
017c5c7
Compare
|
Hello @asmacdo! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on January 07, 2019 at 15:39 Hours UTC |
f89748d
to
7f12da3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asmacdo what about size property on the serializers?
i think the plan was to retrieve this information from the Artifact/RemoteArtifact
7f12da3
to
b2d5736
Compare
| @@ -123,6 +123,9 @@ class BlobManifestBlob(models.Model): | |||
| manifest_blob = models.ForeignKey( | |||
| ManifestBlob, related_name='manifest_blobs', on_delete=models.CASCADE) | |||
|
|
|||
| class Meta: | |||
| unique_together = ('manifest', 'manifest_blob') | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After adding the viewsets, I found that the many-to-many relationships were being written multiple times. This made the serialization really ugly, and I wasn't sure it was working correctly, so I went ahead and fixed this problem since it was simple.
If preferred, I can break these changes into a different PR, but making the change makes it easier to check that the viewsets/serializers were working as expected
| """ | ||
| Create a new ManifestListTag from a request. | ||
| """ | ||
| raise NotImplementedError() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the parent ViewSet includes POST (create), it is necessary to override this-- and because the upload functionality is sufficiently complex, I think it should be done in a separate issue/PR. I'll file that issue before I merge.
b2d5736
to
cdc3237
Compare
pulp_docker/app/serializers.py
Outdated
| Even though Docker content can only have 1 Artifact, this field should be used with | ||
| `many=True` because the Artifact is related with the ContentArtifact through table, and when | ||
| the same Artifact is served at multiple relative_paths, there are multiple associations of | ||
| between a given Content and Artifact. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does an artifact get served at multiple relative paths?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only one that I investigated was tag names
This commit leaves POST (create) unimplemented as well as Filters which are each complex enough that they warrent a separate issue and PR. https://pulp.plan.io/issues/3989 fixes #3989
1610d92
to
2bf5485
Compare
|
Here's how a blob serializers, FYI |
Previously, ImageManifests that were tagged were had multiple relations to the same artifact, 1 for the sha and 1 for each tag. This was caused by sharing the DeclarativeArtifact between the tags and the ImageManifest during sync. After those relations were pruned, update the serializers and models to a single-artifact Content. [noissue]
2bf5485
to
5544e14
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this out and it worked for me. Thanks!
|
There was some concern about some Manifests that associate the same blob more than once. I am thinking this problem was environmental however. I tested this with busybox and got the expected results. If anyone encounters this problem, please have a look at the db using shell_plus. This query returned 1 result, which was a Manifest that indeed had 2 blobs, but they were distinct. |
|
FWIW, I also tested this by running multiple syncs, and got the same results as above. |
|
@asmacdo i confirm that it was env issue |
This commit leaves POST (create) unimplemented as well as Filters which
are each complex enough that they warrent a separate issue and PR.
https://pulp.plan.io/issues/3989
fixes #3989