New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add modelling for "Errata" content #1109
Conversation
pulp_rpm/app/models.py
Outdated
|
||
collections = models.TextField(blank=True) # formerly "pkglist" | ||
references = models.TextField(blank=True) | ||
|
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.
With UpdateCollections and UpdateReferences, much like with "depends" we can either go the route of JSON representation, or make actual models with a foreign key that provides a related_name of "collections".
Do we have a preference? Is there value in modelling it vs. shoving it into JSON?
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.
Pulp 2 did model "pkglist" / collections separately
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 suggest to go with the simplest solution at this point aka JSON. We can move to models later if we need to.
I hope we won't take the approach similar to pulp 2 for errata :)
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.
+1 to JSON for simplicity. Are we using the custom json field or just storing it as a StringField and serializing/deserailizing when we read/write?
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.
TextField for now... messing with JSONField directly is fraught with enough pitfalls generally speaking that until further notice I wouldn't want to rely on it. It works fine for reading (how we use it with Tasks) but writing is really hard to make work properly
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.
Great. +1 to using TextField for now.
8e91c06
to
5f2aa44
Compare
5f2aa44
to
aa829e7
Compare
8c1bfd1
to
8786af7
Compare
@goosemania Updated. I will squash the commits before we merge. |
28e75d0
to
ab80e6b
Compare
The "id" field on the UpdateRecord model conflicts with the "id" field on the Content model, we need to rename one of them |
@dralley I think we need to change the "id" on the "Content model itself to pulp_id. This is the second content type I've heard that can't use the expected field name because Pulp is already asserting it. |
@bmbouter Should we take it to #pulp-dev then? |
97329d7
to
7fb01c4
Compare
5905e11
to
8fee4d7
Compare
pulp_rpm/app/models.py
Outdated
# Bookeeping | ||
uniqueness_hash = models.TextField(unique=True) | ||
|
||
@property |
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.
Have not tested this, it probably doesn't work. It's just a conceptual thing
pulp_rpm/app/models.py
Outdated
@@ -200,6 +203,184 @@ class SrpmContent(RpmContent): | |||
TYPE = 'srpm' | |||
|
|||
|
|||
class UpdateRecord(Content): | |||
""" | |||
The "UpdateRecord" content type. Formerly "Errata". |
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.
s/Errata/Erratum/ ?
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.
Nope, referring to the actual model name
https://github.com/pulp/pulp_rpm/blob/2-master/plugins/pulp_rpm/plugins/db/models.py#L1092
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.
Ah, can you maybe clarify this comment then by saying something like 'Formerly "Errata" in Pulp 2'?
For some models in pulp_rpm, we're using Content in the name (RpmContent, SrpmContent) but these records lack the Content suffix. What about renaming RpmContent and SrpmContent to Rpm and Srpm to be consistent? |
Is that a problem? In the Python plugin, the model is named |
I think it's inconsistent. It should either be UpdateRecordContent, RpmContent, etc or UpdateRecord, Rpm, etc. |
So, I think this is an interesting question. One point: ATM the Errata-related models don't subclass @bmbouter Do you know if that is correct and/or have input? I should have brought this up as a discussion topic at some point. |
Doesn't |
Also, I'm not arguing for or against subclassing |
I think the way you have it is correct. The litmus test is probably whether a content unit can be added to a repository via RepositoryContent and have endpoints under places like Another example of an artifact-less content unit is package group. |
8fee4d7
to
1857278
Compare
24f7e3d
to
23725d6
Compare
23725d6
to
a788688
Compare
closes #3201
https://pulp.plan.io/issues/3201