Bug 1994651

Summary: Pulp migration failed with "NoMethodError: undefined method `pulp_id' for nil:NilClass"
Product: Red Hat Satellite Reporter: Devendra Singh <desingh>
Component: RepositoriesAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Cole Higgins <chiggins>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.9.0CC: ahumbe, jjeffers, jsherril, pcreech, pmendezh, ttereshc
Target Milestone: 6.9.6Keywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.18.1.38-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-09-21 14:37:27 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 Devendra Singh 2021-08-17 15:52:35 UTC
Description of problem: Pulp migration failed with "NoMethodError: undefined method `pulp_id' for nil:NilClass"


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

How reproducible:
always with

Steps to Reproduce:
1. Restore the 6.9.z satellite by using a specific customers database backup.
2. Satellite restored successfully.
3. Run the pulp migration and it gets failed with "NoMethodError: undefined method `pulp_id' for nil:NilClass" error.

Actual results:
pulp migration failed due to "NoMethodError: undefined method `pulp_id' for nil:NilClass" error.

Expected results:
pulp migration should be completed successfully.


Additional info: The error was happening due to corrupt data in the database, for the workaround, we can use "foreman-rake katello:correct_repositories COMMIT=true"

Comment 2 Justin Sherrill 2021-08-17 23:48:28 UTC
Created redmine issue https://projects.theforeman.org/issues/33278 from this bug

Comment 3 Justin Sherrill 2021-08-17 23:50:22 UTC
2021-08-17T10:04:23 [E|bac|] undefined method `pulp_id' for nil:NilClass (NoMethodError)
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.33/app/services/katello/pulp3/migration_plan.rb:68:in `library_migration_for'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.33/app/services/katello/pulp3/migration_plan.rb:42:in `block in repository_migrations'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/relation/delegation.rb:87:in `each'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.33/app/services/katello/pulp3/migration_plan.rb:41:in `repository_migrations'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.33/app/services/katello/pulp3/migration_plan.rb:25:in `block in generate_plugins'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.33/app/services/katello/pulp3/migration_plan.rb:22:in `map'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.33/app/services/katello/pulp3/migration_plan.rb:22:in `generate_plugins'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.33/app/services/katello/pulp3/migration_plan.rb:15:in `block in generate'

Comment 4 Bryan Kearney 2021-08-18 00:05:38 UTC
Upstream bug assigned to jsherril

Comment 5 Bryan Kearney 2021-08-18 00:05:41 UTC
Upstream bug assigned to jsherril

Comment 6 Bryan Kearney 2021-08-20 00:05:37 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/33278 has been resolved.

Comment 13 errata-xmlrpc 2021-09-21 14:37:27 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.6 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:3628