Project

Profile

Help

Issue #6062

closed

Migration doesn't handle repos that are removed and then re-created

Added by jsherril@redhat.com about 4 years ago. Updated almost 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Katello
Sprint:
Sprint 65
Quarter:

Description

If i generate a migration plan with some set of repositories, then one is removed in pulp2, and recreated with the same pulp_id. If i then re-run the exact same migration plan, pulp3 will error with this:

Traceback (most recent call last):
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/worker.py", line 822, in perform_job
rv = job.perform()
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 605, in perform
self._result = self._execute()
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 611, in _execute
return self.func(*self.args, **self.kwargs)
File "/usr/local/lib/pulp/src/pulp/pulp_2to3_migration/app/tasks/migrate.py", line 116, in migrate_from_pulp2
loop.run_until_complete(migrate_distributors(plan))
File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete
return future.result()
File "/usr/local/lib/pulp/src/pulp/pulp_2to3_migration/app/migration.py", line 205, in migrate_distributors
migrated_repo = Pulp2Repository.objects.get(pulp2_repo_id=repo_id)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/query.py", line 412, in get
(self.model._meta.object_name, num)
pulp_2to3_migration.app.models.repository.Pulp2Repository.MultipleObjectsReturned: get() returned more than one Pulp2Repository -- it returned 2!
Traceback (most recent call last):
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/worker.py", line 822, in perform_job
rv = job.perform()
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 605, in perform
self._result = self._execute()
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 611, in _execute
return self.func(*self.args, **self.kwargs)
od.27017[2028]: [conn229] end connection 127.0.0.1:41024 (39 connections now open)
File "/usr/local/lib/pulp/src/pulp/pulp_2to3_migration/app/tasks/migrate.py", line 116, in migrate_from_pulp2
loop.run_until_complete(migrate_distributors(plan))
File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete
return future.result()
File "/usr/local/lib/pulp/src/pulp/pulp_2to3_migration/app/migration.py", line 205, in migrate_distributors
migrated_repo = Pulp2Repository.objects.get(pulp2_repo_id=repo_id)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/query.py", line 412, in get
(self.model._meta.object_name, num)
pulp_2to3_migration.app.models.repository.Pulp2Repository.MultipleObjectsReturned: get() returned more than one Pulp2Repository -- it returned 2!

If you have trouble re-creating the issue, i can try to nail down exact steps, but it should be something like:

1. create a file repo in pulp2
2. Run a migration plan like:
{
"plugins":[
{
"type":"iso",
"repositories":[
{
"name":"5b08c8a6-d3bb-41af-9cd4-cadf8fec2a55",
"repository_versions":[
{
"pulp2_repository_id":"5b08c8a6-d3bb-41af-9cd4-cadf8fec2a55",
"pulp2_distributor_repository_ids":[
"5b08c8a6-d3bb-41af-9cd4-cadf8fec2a55"
]
}
],
"pulp2_importer_repository_id":"5b08c8a6-d3bb-41af-9cd4-cadf8fec2a55"
}
]
}
]
}

3. delete the repo in pulp2, recreate it with the exact same pulp_id for importers and distributors.
4. re-run the migration plan

Actions #1

Updated by ipanova@redhat.com about 4 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to ipanova@redhat.com
  • Sprint set to Sprint 65
Actions #2

Updated by ipanova@redhat.com about 4 years ago

  • Status changed from ASSIGNED to POST

Added by ipanova@redhat.com about 4 years ago

Revision f3d5f962 | View on GitHub

Handle case when repos are removed and re-created.

closes #6062

Added by ipanova@redhat.com about 4 years ago

Revision f3d5f962 | View on GitHub

Handle case when repos are removed and re-created.

closes #6062

Added by ipanova@redhat.com about 4 years ago

Revision f3d5f962 | View on GitHub

Handle case when repos are removed and re-created.

closes #6062

Actions #3

Updated by ipanova@redhat.com about 4 years ago

  • Status changed from POST to MODIFIED
Actions #4

Updated by ipanova@redhat.com about 4 years ago

  • Description updated (diff)
  • Triaged changed from No to Yes
Actions #7

Updated by ttereshc about 4 years ago

  • Sprint/Milestone set to 0.1.0
Actions #8

Updated by ttereshc about 4 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Actions #9

Updated by ggainey almost 4 years ago

  • Tags Katello added
  • Tags deleted (Katello-P2)

Also available in: Atom PDF