Bug 2001697

Summary: content prepare fails with Katello::Errors::Pulp3Error: ‘NoneType’ object has no attribute ‘url’
Product: Red Hat Satellite Reporter: Tanya Tereshchenko <ttereshc>
Component: PulpAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Griffin Sullivan <gsulliva>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.9.0CC: ggainey, jjeffers, osousa, rchan, ttereshc
Target Milestone: 6.9.7Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-pulp_2to3_migration-0.11.5 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-10 16:23:39 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 Tanya Tereshchenko 2021-09-06 20:35:11 UTC
Description of problem:

For some distribution(kickstart) trees, content migration fails with

```
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/rq/worker.py", line 936, in perform_job
pulpcore-worker-2[51205]: rv = job.perform()
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/rq/job.py", line 684, in perform
pulpcore-worker-2[51205]: self._result = self._execute()
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/rq/job.py", line 690, in _execute
pulpcore-worker-2[51205]: return self.func(*self.args, **self.kwargs) 
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/tasks/migrate.py", line 81, in migrate_from_pulp2
pulpcore-worker-2[51205]: migrate_content(plan, skip_corrupted=skip_corrupted)
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/migration.py", line 55, in migrate_content
pulpcore-worker-2[51205]: plugin.migrator.migrate_content_to_pulp3(skip_corrupted=skip_corrupted)
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/rpm/migrator.py", line 150, in migrate_content_to_pulp3
pulpcore-worker-2[51205]: loop.run_until_complete(dm.create()) 
pulpcore-worker-2[51205]: File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete
pulpcore-worker-2[51205]: return future.result()
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/content.py", line 89, in create
pulpcore-worker-2[51205]: await pipeline
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/pulpcore/plugin/stages/api.py", line 225, in create_pipeline
pulpcore-worker-2[51205]: await asyncio.gather(*futures)
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/pulpcore/plugin/stages/api.py", line 43, in __call__
pulpcore-worker-2[51205]: await self.run()
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/content.py", line 181, in run
pulpcore-worker-2[51205]: self.migrate_to_pulp3(cmodel, ctype) 
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/content.py", line 375, in migrate_to_pulp3
pulpcore-worker-2[51205]: url=os.path.join(remote.url, relative_path),
pulpcore-worker-2[51205]: AttributeError: 'NoneType' object has no attribute 'url'
pulpcore-worker-2[51205]: Traceback (most recent call last):
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/rq/worker.py", line 936, in perform_job
pulpcore-worker-2[51205]: rv = job.perform()
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/rq/job.py", line 684, in perform
pulpcore-worker-2[51205]: self._result = self._execute()
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/rq/job.py", line 690, in _execute
pulpcore-worker-2[51205]: return self.func(*self.args, **self.kwargs) 
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/tasks/migrate.py", line 81, in migrate_from_pulp2
pulpcore-worker-2[51205]: migrate_content(plan, skip_corrupted=skip_corrupted)
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/migration.py", line 55, in migrate_content
pulpcore-worker-2[51205]: plugin.migrator.migrate_content_to_pulp3(skip_corrupted=skip_corrupted)
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/rpm/migrator.py", line 150, in migrate_content_to_pulp3
pulpcore-worker-2[51205]: loop.run_until_complete(dm.create()) 
pulpcore-worker-2[51205]: File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete
pulpcore-worker-2[51205]: return future.result()
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/content.py", line 89, in create
pulpcore-worker-2[51205]: await pipeline
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/pulpcore/plugin/stages/api.py", line 225, in create_pipeline
pulpcore-worker-2[51205]: await asyncio.gather(*futures)
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/pulpcore/plugin/stages/api.py", line 43, in __call__
pulpcore-worker-2[51205]: await self.run()
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/content.py", line 181, in run
pulpcore-worker-2[51205]: self.migrate_to_pulp3(cmodel, ctype) 
pulpcore-worker-2[51205]: File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/content.py", line 375, in migrate_to_pulp3
pulpcore-worker-2[51205]: url=os.path.join(remote.url, relative_path),
pulpcore-worker-2[51205]: AttributeError: 'NoneType' object has no attribute 'url'

```

Steps to Reproduce*
1. In Pulp 2, sync with immediate policy a kickstart repo which has images
2. Create a copy of this repo (create a CV)
3. Migrate without specifying an importer, or migrate only the copied repo

*These are steps only in Pulp terms, I'll update the description when we figure out the steps in Satellite to achieve that.


There are multiple reports of this issue upstream.

Comment 1 pulp-infra@redhat.com 2021-09-06 21:08:06 UTC
The Pulp upstream bug status is at POST. Updating the external tracker on this bug.

Comment 2 pulp-infra@redhat.com 2021-09-06 21:08:07 UTC
The Pulp upstream bug priority is at Normal. Updating the external tracker on this bug.

Comment 3 pulp-infra@redhat.com 2021-09-10 13:15:55 UTC
The Pulp upstream bug status is at ASSIGNED. Updating the external tracker on this bug.

Comment 4 pulp-infra@redhat.com 2021-09-10 13:15:56 UTC
The Pulp upstream bug priority is at Normal. Updating the external tracker on this bug.

Comment 5 pulp-infra@redhat.com 2021-09-10 14:07:48 UTC
The Pulp upstream bug status is at MODIFIED. Updating the external tracker on this bug.

Comment 6 pulp-infra@redhat.com 2021-09-10 15:08:28 UTC
All upstream Pulp bugs are at MODIFIED+. Moving this bug to POST.

Comment 7 Tanya Tereshchenko 2021-09-10 20:16:59 UTC
Fixed in pulp-2to3-migration 0.11.5.

Comment 8 pulp-infra@redhat.com 2021-09-10 21:07:00 UTC
The Pulp upstream bug status is at CLOSED - CURRENTRELEASE. Updating the external tracker on this bug.

Comment 10 Griffin Sullivan 2021-10-13 16:45:52 UTC
Verified in 6.9.7 snap 1

Code from the attached upstream issue is in the snap. I also tested re-migration and found no regressions or errors with the content views.

Steps to Reproduce:
1. Enable and Sync RHEL 7 Kickstart
2. Create a new content view with the repo
3. Run satellite-maintain content prepare
4. Delete the content view and create a new one (I recreated with a synced RHEL 8 Kickstart)
5. Run satellite-maintain content prepare

Expected Results:
No errors or regressions before and after the content prepare commands.

Actual Results:
No errors or regressions before and after the content prepare commands.

Comment 15 errata-xmlrpc 2021-11-10 16:23:39 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.7 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:4612