Bug 2141810

Summary: When working with CCV, include and exclude filters, eventually the number of packages in the CCV will not be as expected, causing problems to the customer
Product: Red Hat Satellite Reporter: Waldirio M Pinheiro <wpinheir>
Component: Content ViewsAssignee: Ian Ballou <iballou>
Status: CLOSED ERRATA QA Contact: Sam Bible <sbible>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.11.0CC: iballou, pcreech, sbible
Target Milestone: 6.13.0Keywords: Regression, Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-03 13:22:42 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 Waldirio M Pinheiro 2022-11-10 19:02:39 UTC
Description of problem:
When working with ccv, cv, include and exclude filters, there are some situations where the total # of packages are not matching in the ccv at the end of the day.

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

How reproducible:
100%

Steps to Reproduce:
1. Create CV
2. Create CCV
3. Publish
4. Create the exclude filter, just a single package
5. Create the include filter, adding all the packages

Actual results:
Eventually, the # of packages in the ccv will not match with the expected

Expected results:
The total # of packages should be the sum of all the content views, packages and modules

Additional info:
Checking it with iballou

Comment 1 Ian Ballou 2022-11-10 19:11:32 UTC
the important thing that I noticed on the reproducer was that, at some point during the composite content view publish, the AppStream 8 repository gets all of its content removed. It appears that this is happening because one of the component content view versions has AppStream 8 with no content in it.  This part of the code is likely triggering and removing all previously copied content from the content view version: https://gitlab.cee.redhat.com/satellite/katello/-/blob/SATELLITE-6.11.0/app/services/katello/pulp3/repository/yum.rb#L214

For composites, if multiple component CV versions include the same repo, we merge the repositories together. So, the target repository is the same. The code above is likely telling Pulp to clear out the repo incorrectly.

Comment 2 Ian Ballou 2022-11-10 19:26:35 UTC
Reproducer steps from my testing:

1) Create two component content views with the same repository in it
2) Add a filter to one of the repositories to clear out all content
3) Publish both content views
4) Create a composite content view with both component content views in it
5) Publish that content view
6) If there is any content in the composite content view version, add `source_repositories = source_repositories.reverse` here: https://gitlab.cee.redhat.com/satellite/katello/-/blob/SATELLITE-6.11.0/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb#L21
7) The next publish of the composite version should result in no content being available in the component content view version

To fix the issue, we need to ensure that the "remove all content from repo" call above does not occur for composite content view "merge" copies of the same base repository.

Comment 3 Ian Ballou 2022-11-10 19:31:10 UTC
Created redmine issue https://projects.theforeman.org/issues/35740 from this bug

Comment 5 Bryan Kearney 2022-11-11 00:03:41 UTC
Upstream bug assigned to iballou

Comment 6 Bryan Kearney 2022-11-11 00:03:44 UTC
Upstream bug assigned to iballou

Comment 7 Bryan Kearney 2022-11-17 00:03:51 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/35740 has been resolved.

Comment 8 Sam Bible 2023-02-21 17:53:33 UTC
Verified on 6.13 - Snap 11

Steps to Verify:
1) Create two component content views with the same repository in it
2) Add a filter to one of the repositories to clear out all content
3) Publish both content views
4) Create a composite content view with both component content views in it
5) Publish that content view

Expected results:
All content should be present.

Actual results:
All content is present.

Comment 11 errata-xmlrpc 2023-05-03 13:22:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Satellite 6.13 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:2097