-
Notifications
You must be signed in to change notification settings - Fork 53
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
Mutable Prototype #389
Mutable Prototype #389
Conversation
Attached issue: https://pulp.plan.io/issues/7504 |
def get_queryset(self): | ||
""" | ||
Returns a MutableCollectionMetadata queryset for specified distribution. | ||
""" | ||
return RepositoryVersion.objects.filter( | ||
pk=self.get_repository_version(self.kwargs["path"]).pk | ||
).prefetch_related( | ||
Prefetch( | ||
"collection_memberships", | ||
queryset=MutableCollectionMetadata.objects.filter(deprecated=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.
Problem: only displays deprecated for the last RepositoryVersion
Question: how to determine which content remains at the Repository
, to get the correspondent MutableCollectionMetadata
?
@@ -38,6 +38,11 @@ | |||
] | |||
|
|||
v3_urls = [ | |||
path( | |||
"metadata/", | |||
views_v3.MutableCollectionMetadataViewset.as_view({"get": "list"}), |
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.
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.
Sync should check for the last_updated
if self.request.query_params.get("deprecated", "").lower() in ["true", "yes", "1"]: | ||
deprecated = True | ||
|
||
return queryset.filter(collection__mutablecollectionmetadata__deprecated=deprecated) |
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.
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.
Bring all collections by default, only filter deprecation with query params
[noissue]
[noissue]
import uuid | ||
|
||
|
||
class Migration(migrations.Migration): |
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.
There should be a step here to migrate the deprecation status over to MutableCollectionMetadata
before the deprecated field is removed from the collections table.
class MutableCollectionMetadata(BaseModel): | ||
""" | ||
A model that represents Collection mutable metadata for a given RepositoryVersion. | ||
""" | ||
|
||
repository_version = models.ForeignKey( | ||
RepositoryVersion, on_delete=models.CASCADE, related_name="collection_memberships" | ||
) | ||
collection = models.ForeignKey(Collection, on_delete=models.CASCADE) | ||
deprecated = models.BooleanField(default=False) | ||
|
||
class Meta: | ||
unique_together = ("collection", "repository_version") |
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.
- Should we make it sparse?
- What about CollectionVersion metadata?
metadata_downloader = remote.get_downloader( | ||
url=get_metadata_url(url), silence_errors_for_response_status_codes={404} | ||
) | ||
try: | ||
mutable_data = parse_metadata(await metadata_downloader.run()) | ||
except FileNotFoundError: | ||
mutable_data = {} |
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.
Sync should consider last_updated
for optimization
from pulp_ansible.app.models import AnsibleRepository, MutableCollectionMetadata | ||
|
||
|
||
def add_and_remove(repository_pk, add_content_units, remove_content_units, base_version_pk=None): |
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.
Used in synclist - "custom" sync between repositories
closing in favor of #392 |
Following: https://hackmd.io/@pulp/deprecation