Modify remote url with parameter --retain-package-version is broken

Problem: when I try to modify a url and my repository is configured with --retain-package-version, I have the following error message during sync:

pulp rpm repository sync --mirror --name ${REPONAME}

Create a task to sync the repository using the remote.
Error: [“Cannot use ‘retain_package_versions’ in combination with a ‘mirror_complete’ or ‘mirror_content_only’ sync policy.”]

is there a possible workaround ?

Pulpcore version:
“component”: “core”,
“version”: “3.20.0”,
“package”: “pulpcore”

Pulp plugins installed and their versions:

  "component": "rpm",
  "version": "3.17.7",
  "package": "pulp-rpm"
  "component": "file",
  "version": "1.10.3",
  "package": "pulp-file"
  "component": "container",
  "version": "2.13.0",
  "package": "pulp-container"
  "component": "ansible",
  "version": "0.14.0",
  "package": "pulp-ansible"

Operating system - distribution and version: alma 8.6

I would not call it a workaround. But as the error message suggests, mirroring the exact content from the upstream source puts the burden of deciding which package versions to keep to the upstream. That is why you cannot use these options together. So either you do not specify (unconfigure) retain_package_versions or you switch to a different sync mode.
The choice obviously depends on your use case.

ok, I understand but all my repositories are created with a retain-package-version, I made a mistake on the url of the remote when I wanted to change it, I always get the same error, I don’t understand how changing the sync policy of “immediate / on-demand / streamed” solves the problem, do you have any documentation on this?

Thank you

Ah, sorry, it’s not about the “sync policy” (immediate, on demand, …) [HOW] but about the “sync mode” (full mirror, additive) [WHAT].
In mirror mode the sync will attempt to recreate the exact state of the upstream source purging all no longer available packages. This contradicts the logic that pulp should decide how many versions of a package to keep.

it is possible to modify it via the pulp-cli ? what I was thinking of doing :

update the remote

pulp rpm remote update --url $MYNEWRURL --name $MYREPO

force resync repo

http POST ${BASE_ADDR}${REPO_HREF}sync/ remote="${REMOTE_HREF}" optimize=False

create publication

pulp rpm publication create --name $MYREPO

update the distribution

pulp rpm distribution update --name "$MYREPO" --publication "${PUBLICATION_HREF}"

but it doesn’t work, it doesn’t download packages from the new remote

I’m late to the party here, my apologies. I see two problems here - correct me if I’m missing something!

First - “mirror” and “retain-package-versions” are incompatible, as x9c4 has pointed out. If you’ve set retain-package-versions on your repository, but you really want to use mirror, you’ll want to reset r-p-v: pulp rpm repository update --retain-package-versions 0

The second problem I’m seeing is, “updating the URL of a remote and resyncing isn’t getting any new packages downloaded”. Can you share the URLs you’re using? If not, can you give an example of “here’s an RPM in the new-remote that I expect to see downloaded, that isn’t”, along with a dump of the repository and (updated) remote? We’ll see if we can figure out what’s going on.

(Note: pulp-cli’s next release will include --optimize and --sync-policy on the rpm repository sync command, but they’re not in a release-version yet)

1 Like