Issue #9039
closedBehavior of auto-distribute is counterintuitive
Description
The distribution use cases are roughly as follows:
-
A basic user with a small number of repos will want to set up their repos with the minimum amount of effort, and is less likely to be scripting the workflow. They likely don't want to ever mess with manually setting the publication every time the repository is updated. So they want to set the repository on their distribution so that it is automatically receives the latest metadata.
-
An advanced user that wants complete control of when their repo paths are updated will want to script their pipeline to create publications and then manually distribute them all at once. They are less likely to want auto-distribute enabled at all.
Auto-distribute falls pretty squarely into the first use case. If such a user sets the "repository" on their distribution, then they likely want the latest metadata available, which means the latest publication from the latest repository version.
The current behavior If I set the "repository" on a distribution, then only the very first publication for the latest repository version will be distributed - later publications are ignored. If a user is using auto-distribution and they want to fix the metadata for an existing repository version by re-publishing, then they would have to un-set "repository" and then manually set the publication, which would completely change the behavior of that distribution in the future.
Whereas with the previously described behavior, if they want to fix up the metadata for some reason, they can just make a new publication.
This change consists of 2 parts, updating the content app to change the sort order, and updating the cache invalidation to invalidate the cache when a new publication is created for a repository version.
There's one additional issue I noticed in the code:
versions = repository.versions.all()
publications = Publication.objects.filter(
repository_version__in=versions, complete=True
)
publication = publications.latest("repository_version", "-pulp_created")
I think "repository_version" is going to sort by the value of the PK, not the value of the repository version "number". The correct (or at least more explicit) query would be .latest("repository_version__number", ...)
Related issues
Updated by dalley over 3 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to dalley
Updated by pulpbot over 3 years ago
- Status changed from ASSIGNED to POST
Updated by dalley over 3 years ago
- Related to Backport #9059: Backport 9039 "behavior of auto-distribute is unintuitive" to 3.14.z added
Added by dalley over 3 years ago
Updated by dalley over 3 years ago
- Status changed from POST to MODIFIED
Applied in changeset pulpcore|2cc98040f323530245f198486c9a28f81839f31a.
Updated by pulpbot over 3 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Make auto-distribute feature more intuitive
closes: #9039 https://pulp.plan.io/issues/9039