Bug 1976351

Summary: Promoting a content view or publishing/promoting a composite after initial migration causes errata to never be migrated
Product: Red Hat Satellite Reporter: Justin Sherrill <jsherril>
Component: RepositoriesAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Danny Synk <dsynk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.9.0CC: dsynk, jjeffers, peter.vreman, zhunting
Target Milestone: 6.9.5Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: katello-3.18.1.36 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-08-31 12:04:00 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:
Bug Depends On:    
Bug Blocks: 1957813    

Description Justin Sherrill 2021-06-25 20:13:29 UTC
Steps to Reproduce:
1.  Create and sync some repo with errata
2.  Publish the repo in a content view
3.  run 'foreman-maintain content prepare'
4.  Note in 'foreman-maintain content migration-stats' that all errata are migrated

Next do one of the following:

5.  promote the CV to a new lifecycle environment
OR
5.  publish the CV in a composite content view

6.  Re-run the migration 'foreman-maintain content prepare'
7.  Re-run  'foreman-maintain content migration-stats'

Actual results:

Not all errata will be migrated, error given when running switchover

Expected results:
All errata are migrated

Additional info:

Comment 2 Justin Sherrill 2021-06-25 20:42:44 UTC
Created redmine issue https://projects.theforeman.org/issues/32888 from this bug

Comment 3 Bryan Kearney 2021-06-26 00:04:39 UTC
Upstream bug assigned to jsherril

Comment 4 Bryan Kearney 2021-06-26 00:04:41 UTC
Upstream bug assigned to jsherril

Comment 5 Bryan Kearney 2021-07-13 16:04:47 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32888 has been resolved.

Comment 6 Danny Synk 2021-08-26 19:30:12 UTC
Verified on Satellite 6.9.5, snap 3.

Steps to Test:
1. Synchronize the rhel-8-for-x86_64-baseos-rpms repository.
2. Create a new content view containing the above repo and publish the first version of the content view.
3. Run `foreman-maintain content prepare`.
4. Confirm that all errata were migrated successfully:

~~~
# foreman-maintain content migration-stats
Running Retrieve Pulp 2 to Pulp 3 migration statistics
================================================================================
Retrieve Pulp 2 to Pulp 3 migration statistics: 
============Migration Summary================
Migrated/Total RPMs: 8038/8038
Migrated/Total errata: 2808/2808
Migrated/Total repositories: 4/4

Estimated migration time based on yum content: fewer than 5 minutes
~~~

5. Promote the content view version to a new lifecycle environment.
6. Run `foreman-maintain content prepare` again.
7. Confirm that all errata were migrated successfully:

~~~
# foreman-maintain content migration-stats
Running Retrieve Pulp 2 to Pulp 3 migration statistics
================================================================================
Retrieve Pulp 2 to Pulp 3 migration statistics: 
============Migration Summary================
Migrated/Total RPMs: 8038/8038
Migrated/Total errata: 3744/3744
Migrated/Total repositories: 5/5

Estimated migration time based on yum content: fewer than 5 minutes
~~~

Comment 11 errata-xmlrpc 2021-08-31 12:04:00 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 (Satellite 6.9.5 Async Bug Fix Update), 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/RHBA-2021:3387