Actions
Issue #6980
closedcomps migration fails if repository was recreated and migrated again
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 75
Quarter:
Description
To reproduce:
- in pulp 2 create a repo "myrepo" and sync from a remote source which has comps types
- run migration for that repo
- delete "myrepo" in pulp2 and clean orphans
- create the same repo with the same name in pulp2, sync the same content again
- run the migration again
- see the following error
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: Traceback (most recent call last):
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/worker.py", line 886, in perform_job
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: rv = job.perform()
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 664, in perform
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: self._result = self._execute()
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 670, in _execute
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: return self.func(*self.args, **self.kwargs)
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: File "/home/vagrant/devel/pulp-2to3-migration/pulp_2to3_migration/app/tasks/migrate.py", line 127, in migrate_from_pulp2
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: migrate_content(plan)
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: File "/home/vagrant/devel/pulp-2to3-migration/pulp_2to3_migration/app/migration.py", line 34, in migrate_content
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: plugin.migrator.migrate_content_to_pulp3()
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: File "/home/vagrant/devel/pulp-2to3-migration/pulp_2to3_migration/app/plugin/rpm/migrator.py", line 148, in migrate_content_to_pulp3
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: loop.run_until_complete(dm.create())
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: return future.result()
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: File "/home/vagrant/devel/pulp-2to3-migration/pulp_2to3_migration/app/plugin/content.py", line 84, in create
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: await pipeline
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: File "/home/vagrant/devel/pulpcore/pulpcore/plugin/stages/api.py", line 225, in create_pipeline
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: await asyncio.gather(*futures)
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: File "/home/vagrant/devel/pulpcore/pulpcore/plugin/stages/api.py", line 43, in __call__
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: await self.run()
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: File "/home/vagrant/devel/pulp-2to3-migration/pulp_2to3_migration/app/plugin/rpm/migrator.py", line 203, in run
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: thru = self.relate_packages_to_group(dc)
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: File "/home/vagrant/devel/pulp-2to3-migration/pulp_2to3_migration/app/plugin/rpm/migrator.py", line 285, in relate_packages_to_group
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: pulp2_repo = Pulp2Repository.objects.get(pulp2_repo_id=pulp2_repo_id)
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: return getattr(self.get_queryset(), name)(*args, **kwargs)
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/query.py", line 412, in get
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: (self.model._meta.object_name, num)
Jun 16 11:22:18 pulp2-nightly-pulp3-source-centos7.rhgoose.example.com rq[8503]: pulp_2to3_migration.app.models.repository.Pulp2Repository.MultipleObjectsReturned: get() returned more than one Pulp2Repository -- it returned 2!
Actions
Fix comps migration for the case when repo is recreated between the runs.
Ensure that only repos from plan are taken into consideration.
closes #6980 https://pulp.plan.io/issues/6980