Bug 1965471

Summary: pulp3 migration/switchover fails if multiple repos have the same label in the same content view
Product: Red Hat Satellite Reporter: Justin Sherrill <jsherril>
Component: RepositoriesAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Lai <ltran>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.9.0CC: jjeffers, ltran, zhunting
Target Milestone: 6.9.5Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.18.1.36-1 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:

Description Justin Sherrill 2021-05-27 18:48:21 UTC
Description of problem:


If on a satellite you have two different products with a repository with the same label, for example:

Product A
  Repo w/ label: foo

Product B
  Repo w/ label: foo

and you publish both of these in the same Content view with label 'bar'.  OR

You have such things in two different orgs, and you publish them in two different content views with the same label.  Migration will succeed, but content-stats will show:

============Migration Summary================
Migrated/Total RPMs: 32/32
Migrated/Total errata: 3/3
Migrated/Total repositories: 4/6


Notice that only 2 out of 4 repos are migrated!  If you try to do a switchover, it will fail with:


Failed executing foreman-rake katello:pulp3_post_migration_check, exit status 1:
 ERROR: yum repositories with ID [42880,42948,42418,42600,42238,30634,28592] have a NULL value for version_href


How reproducible:
always

Steps to Reproduce:
1.  Create ProductA
2.  Create a repo in ProductA with label 'foo' pointed to some repo, sync it
3.  Create Product B
4.  Create a repo in ProductB with label 'foo' pointed to some repo, sync it
5.  Add both 'foo' repos to a content view and publish it
6.  run foreman-rake content prepare
7.  run foreman-rake content migration-stats

notice that not all repos are migrated

Comment 1 Justin Sherrill 2021-05-27 18:54:33 UTC
Connecting redmine issue https://projects.theforeman.org/issues/32663 from this bug

Comment 2 Bryan Kearney 2021-07-14 00:04:17 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32663 has been resolved.

Comment 4 Lai 2021-08-09 18:16:36 UTC
Steps to test:

1.  Create ProductA
2.  Create a repo in ProductA with label 'foo' pointed to some repo, sync it
3.  Create Product B
4.  Create a repo in ProductB with label 'foo' pointed to same repo as 2, sync it
5.  Create Product C
6.  Create a repo in ProductC with label 'foo' pointed to some repo, sync it
7.  Add both 'foo' repos to a content view and publish it
8.  run satellite-maintain prep-6.10-upgrade
9.  run satellite-maintain content prepare
10.  run satellite-maintain content migration-stats 

Expected result:
Migrated/Total RPMs: 64/64
Migrated/Total errata: 36/36
Migrated/Total repositories: 9/9

Actual result:
Migrated/Total RPMs: 64/64
Migrated/Total errata: 36/36
Migrated/Total repositories: 9/9

Verified on 6.9.5 snap 1 with tfm-rubygem-katello-3.18.1.36-1.el7sat.noarch

Comment 9 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