Blank package names/versions when uploading to Katello 4.4 deb repo

Problem:
When uploading .deb packages to a newly-created repo in Katello 4.4, the package names and versions show as blank, and are not searchable. They are, however, available in the repo

Expected outcome:
Listing the correct package name/version on upload

Foreman and Proxy versions:
Foreman 3.2.1-1.el7

Foreman and Proxy plugin versions:
Katello 4.4.1-1.el7

Distribution and version:
CentOS 7.9 latest

Other relevant data:
No matter which package is uploaded, Foreman fails to display name/version after upload

This appears to have broken with a recent Katello release, the issue is here: Bug #35060: Deb packages uploaded in debian repository are not displayed - Katello - Foreman

There is another thread about this issue here: New user seeking update / advice with Foreman/Debian - #4 by quba42

Thanks very much quba, I must have missed the other thread going around 2 days ago, appreciate you opening an issue on this.

P.S: For me, sync’ed packages displayed just fine, and the uploaded packages were still available in the repo, just not displayed on the repository page in UI.

1 Like

I manually applied the patches like so, and restarted services. However, it didn’t fix the existing repo. I still see blank rows, and reupload packages in the same repo or new still has the same issue. Any advice?

patch /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.4.1/app/services/katello/pulp3/deb.rb << EOF 
--- /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.4.1/app/services/katello/pulp3/deb.rb.orig   2022-09-17 07:52:03.368158366 +0100
+++ /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.4.1/app/services/katello/pulp3/deb.rb        2022-09-17 07:54:18.740332296 +0100
@@ -9,6 +9,7 @@
       end

       def self.content_api_create(opts = {})
+        opts.delete(:relative_path) if opts.key?(:relative_path)
         self.content_api.create(opts)
       end

@@ -24,7 +25,8 @@
       end

       def self.generate_model_row(unit)
-        {
+        unit = unit.try(:with_indifferent_access)
+        return {
           pulp_id: unit[unit_identifier],
           checksum: unit[:sha256],
           filename: unit[:relative_path],

EOF

patch /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.4.1/app/services/katello/pulp3/pulp_content_unit.rb << EOF
--- /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.4.1/app/services/katello/pulp3/pulp_content_unit.rb.orig     2022-09-17 08:04:37.654697625 +0100
+++ /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.4.1/app/services/katello/pulp3/pulp_content_unit.rb  2022-09-17 08:05:51.107334263 +0100
@@ -141,6 +141,8 @@
         elsif repository.generic?
           duplicate_sha_path_content_list = content_backend_service.content_api(repository.repository_type, unit_type_id).list(
             filter_label => checksum)
+        elsif unit_type_id == 'deb'
+          duplicate_sha_path_content_list = content_backend_service.content_api.list(filter_label => checksum)
         else
           duplicate_sha_path_content_list = content_backend_service.content_api.list(
             filter_label => checksum,
EOF

btw, the patches work for new files

Here is a workaround for existing repos:

  1. Download all packages from affected repositories, and note repository names, labels, and package count
  2. Delete repositories that reference affected packages
  3. Run delete orphaned content
  4. Re-create repositories and re-upload all the packages

Not ideal if you have content views as everything will need to be recreated