Actions
Issue #7876
closedNoneType' object has no attribute 'pk'
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Katello
Sprint:
Sprint 90
Quarter:
Q1-2021
Description
On a fresh pulp3 installation, running consecutive 2to3 migrations results in following error (first migration ran without error):
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: Traceback (most recent call last):
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: File "/usr/lib/python3.6/site-packages/rq/worker.py", line 936, in perform_job
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: rv = job.perform()
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: File "/usr/lib/python3.6/site-packages/rq/job.py", line 684, in perform
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: self._result = self._execute()
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: File "/usr/lib/python3.6/site-packages/rq/job.py", line 690, in _execute
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: return self.func(*self.args, **self.kwargs)
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/tasks/migrate.py", line 139, in migrate_from_pulp2
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: migrate_content(plan)
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/migration.py", line 36, in migrate_content
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: plugin.migrator.migrate_content_to_pulp3()
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/rpm/migrator.py", line 140, in migrate_content_to_pulp3
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: loop.run_until_complete(dm.create())
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: return future.result()
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: File "/usr/lib/python3.6/site-packages/pulp_2to3_migration/app/plugin/content.py", line 88, in create
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: await pipeline
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: File "/usr/lib/python3.6/site-packages/pulpcore/plugin/stages/api.py", line 225, in create_pipeline
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: await asyncio.gather(*futures)
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: File "/usr/lib/python3.6/site-packages/pulpcore/plugin/stages/api.py", line 43, in __call__
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: await self.run()
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: File "/usr/lib/python3.6/site-packages/pulpcore/plugin/stages/artifact_stages.py", line 244, in run
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: RemoteArtifact.objects.bulk_get_or_create(self._needed_remote_artifacts(batch))
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: File "/usr/lib/python3.6/site-packages/pulpcore/plugin/stages/artifact_stages.py", line 296, in _needed_remote_artifacts
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: if remote_artifact.remote_id == d_artifact.remote.pk:
Nov 19 19:04:08 lxserv2285.smhi.se rq[1208174]: AttributeError: 'NoneType' object has no attribute 'pk'
The first couple of migrations resulted in #7842. Next day, new migration attempt and now I get this, which is produced earlier in the migration process than the previous error.
Running in an rpm-based installation on RHEL8:
python3-pulp-rpm-3.7.0-1.el8.noarch
python3-pulpcore-3.7.3-1.el8.noarch
python3-pulp-2to3-migration-0.5.1-1.el8.noarch
Actions
Adds additional d_artifact.remote check
Not all d_artifact objects have remotes, e.g. the migration plugin does not. Other places in the code account for this, but there is one area that does not. This adds an additional check to one codepath that checks for equality of
d_artifact.remote.pk
only ifd_artifact.remote
exists.closes #7876