RPM repo content list

Problem:
We are migrating to pulp v3 and everything seems to be working properly, however we are struggling to replicate a command we use to determine the most recent version of a package in a specific repo for an automation we have, in pulp v2 the command was:

pulp-admin rpm repo content rpm --str-eq=name=omi --repo-id=azure

However in pulp v3 there seems not to be a command that correlates rpm package with specific repo, as per my research:

  • Closest I have got is to list all omi packages but this is across all repos and cli does not have any parameter to specify repo id:

pulp rpm content list --name-in omi --field location_href

  • The other option is almost impossible to use:

pulp rpm repository content list --repository test-azure --limit 2000

with this one we need to set a limit of at least 2000 for the cli to return all packages this takes a lot of time and then we need to use jq to parse and try to find what we need.

First option is quicker but since we cannot correlate a repo is useless.

What can we do?

Pulpcore version:
“core”: “3.48.0”

Pulp plugins installed and their versions:
“versions”: {
“rpm”: “3.25.1”,
“core”: “3.48.0”,
“file”: “3.48.0”,
“certguard”: “3.48.0”
},
Operating system - distribution and version:
RHEL 9

Other relevant data:

How about something like this?

$ export RV=$(pulp rpm repository show --name zoo | jq -r .latest_version_href)
$ pulp rpm content -t package list --name bear --field location_href --repository-version "${RV}" | jq '.[].location_href'

"bear-4.1-1.noarch.rpm"
2 Likes

Hi @ggainey , will try with that one, thank you. For the copy I saw there is something in the API but is there anything in the CLI that can perform same task as in pulp v2:

pulp-admin rpm repo copy rpm --str-eq=name=omi --from-repo-id=azure --to-repo-id=misc

We just want to have most recent omi rpm in misc repo, no dependencies need to be copied or resolved. Thanks a lot!

pulp-cli is heading-for 100% coverage of the REST api, but it’s a process :slight_smile: That being said - you can track Added support for pulp_rpm advanced-copy command. by ggainey · Pull Request #992 · pulp/pulp-cli · GitHub to see the advanced-copy-workflow support being added.

Advanced-copy is really aimed at entire-repo copying (or at the very least, many-content-objects copying). If you only care about one or a few RPMs, you should look into pulp rpm repository content modify --repository zoo --add-content.

If you want a repository that only keeps the most-recent NEVRA (or N-most-recent), you can set --retain-package-versions N on the repository. That will ensure only the N-highest EVR remains for any given package-name.

2 Likes

Hi @ggainey , thanks a lot for your replies.

1 Like