Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2213911

Summary: Source RPMs showing up as a regular package on custom repository.
Product: Red Hat Satellite Reporter: Anand Kulkarni <ankulkar>
Component: RepositoriesAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED MIGRATED QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.11.5CC: casl, dalley, hyu, iballou
Target Milestone: UnspecifiedKeywords: MigratedToJIRA, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-06-06 16:21:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Anand Kulkarni 2023-06-09 21:01:21 UTC
Description of problem: Source RPMs showing up as a regular package on custom repository.


Version-Release number of selected component (if applicable): 
Red Hat Satellite 6.11

How reproducible: Every Time.

Steps to Reproduce:
1. Create a custom product on Satellite Content -> Product 
2. Create a custom repository in the Product created. 
3. Now add some 'rpm's' and 'src.rpm' and upload.


Actual results:

=> On Satellite GUI on "Content Counts" for the custom repo, the "Source RPMs" count showed 0 even when there are src.rpm's files contained within the custom repo.

Expected results:

=> The "Content Counts" should display the correct content type data.


Additional info:

Comment 3 Ian Ballou 2023-06-12 19:30:51 UTC
We need to check why the SRPMs are being indexed as RPMs. It's likely that the Pulp API is returning them as such, but why? I'm not going to put this on the Pulp component yet since we should confirm whether or not the issue is coming from the Pulp API first.

Comment 4 Daniel Alley 2023-06-12 22:33:59 UTC
From Pulp's perspective a source RPM package is just an normal package with a "arch" of "src".  So for Katello to be indexing them that way does sound correct, it should just be filtering by `arch` when displaying packages that are or are not source packages specifically.

Comment 5 Charles Slivkoff 2023-06-15 18:35:22 UTC
Note please, that calling `Katello::Repository.find(REPOID).index_content` corrects the counts.

Comment 6 Hao Chang Yu 2023-06-19 04:30:17 UTC
(In reply to Daniel Alley from comment #4)
> From Pulp's perspective a source RPM package is just an normal package with
> a "arch" of "src".  So for Katello to be indexing them that way does sound
> correct, it should just be filtering by `arch` when displaying packages that
> are or are not source packages specifically.

The katello upload file api expects a "content_type" param to be provided. If the param is not provided, it will just detect whatever the default content type of the target repository (in this case the rpm).

# lib/actions/katello/repository/upload_files.rb
~~~
content_type ||= ::Katello::RepositoryTypeManager.find(repository.content_type).default_managed_content_type.label  <================
~~~

# lib/actions/katello/repository/filtered_index_content.rb
~~~
          elsif repo.yum?
            if input[:import_upload_task] && input[:import_upload_task][:content_unit_href]
              unit_ids = [input[:import_upload_task][:content_unit_href]]
            elsif input[:upload_actions]&.any? { |action| action.try(:[], "content_unit_href") }
              uploaded_content_unit_hrefs = []
              input[:upload_actions].each { |action| uploaded_content_unit_hrefs << action.try(:[], "content_unit_href") }
              unit_ids = uploaded_content_unit_hrefs.compact
            else
              unit_ids = search_units(repo)
            end
            if input[:content_type] == ::Katello::Srpm::CONTENT_TYPE
              ::Katello::Srpm.import_all(unit_ids, repo, {filtered_indexing: true})
            else
              ::Katello::Rpm.import_all(unit_ids, repo, {filtered_indexing: true}) <======================= This is called in "FilteredIndexContent" action
            end
          end
~~~


The "Katello::Repository.find(repo_id).index_content" method does detect the "src" in the arch field and import the rpm and srpm correctly without issue.

Comment 7 Eric Helms 2024-06-06 16:21:45 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.