On Foreman/Katello 3.16.2/4.18.1 and got a request from our Dev team to add the Grafana repo at https://rpm.grafana.com/ to Foreman/Katello.
Added it as normal but trying to sync that repo ended up with the error
“Cannot create repository version. More than one rpm.package content with the duplicate values for name, epoch, version, release, arch, location_href.”
Tried switching to “Complete Mirroring” from “Content Only” but made no difference.
Turns out the Dev team just wanted the alloy packages from the Grafana repo so I now removed the Upstream URL and just downloaded the latest package https://rpm.grafana.com/Packages/alloy-1.9.2-1.amd64.rpm and uploaded it to the Foreman repo manually. I noticed the name of the package changed to alloy-1.9.2-1.x86_64 after uploading it. Browsing the Foreman repo with a web browser showed the filename “alloy-1.9.2-1.x86_64.rpm”.
Trying to download the package from the repo ends up with “404: Not Found”.
Odd!
I now removed the package from the repo, renamed the file from alloy-1.9.2-1.amd64.rpm to alloy-1.9.2-1.x86_64.rpm. Uploaded the package again but again when I try and download the package I get “404: Not Found”.
Can someone give me a hint on what os going on and possible solution?
Starting with two clean Katello instances that don’t yet have the alloy-1.9.2-1.amd64.rpm package, I uploaded the package with the unchanged name alloy-1.9.2-1.amd64.rpm and on the other instance the modified name alloy-1.9.2-1.x86_64.rpm. In both cases the published RPM on the Katello server is named alloy-1.9.2-1.x86_64.rpm, but I can download it just fine in both versions of the experiment.
I wonder if your issue might be related to the fact that you originally obtained the package on your instance via sync (and only later tried to upload it).
Removing the RPM from a Katello repository and then re-uploading (or for that matter re-syncing) never removes the package from pulp_rpm, and the re-upload will just reuse the package that is still there and (re-)add it to your repo. This means if your original sync somehow resulted in a corrupt/inconsistent DB entry for the package, then all your subsequent attempts at upload might have continued to use that corrupt entry, because it was never removed.
To truely remove that corrupt package, you need to remove all versions of the package from your repositories, AND then delete the package itself from pulp_rpm. Either directly or by running an orphan cleanup with a sufficiently short orphan protection time.
My expectation is that if you did do that and then re-uploaded (the file using either file name), things should work like they did for me. If that is the case then we still have the unanswered question of why it ever broke for you in the first place. My suspicion is that it was when you added the package via repo sync. If that could be confirmed, then that would warrant a new issue with pulp_rpm.
Yea, it seems the failure of first trying to sync https://rpm.grafana.com somehow messed something up in the db.
I removed the repo + product and ran “foreman-rake katello:delete_orphaned_content”. The next day I again created a grafana/alloy repo and added the alloy package and this time all is working.
Now why it is not possible to sync https://rpm.grafana.com is another issue I guess. But I guess this “manual” workaround is good for now.