Project

Profile

Help

Issue #9039

closed

Behavior of auto-distribute is counterintuitive

Added by dalley over 2 years ago. Updated over 2 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

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

Related to Pulp - Backport #9059: Backport 9039 "behavior of auto-distribute is unintuitive" to 3.14.zCLOSED - CURRENTRELEASEdaviddavis

Actions

Also available in: Atom PDF