Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Handle already-migrated 're-created' pulp2 repos
Browse files Browse the repository at this point in the history
  • Loading branch information
ipanova committed Jun 3, 2020
1 parent 65a1618 commit 210bd49
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/6887.bugfix
@@ -0,0 +1 @@
Handle already-migrated 're-created' pulp2 repos
4 changes: 3 additions & 1 deletion pulp_2to3_migration/app/migration.py
Expand Up @@ -186,7 +186,8 @@ def complex_repo_migration(plugin, pulp3_repo_setup, repo_name):
if pulp2_importer_repo_id:
try:
pulp2_importer = Pulp2Importer.objects.get(
pulp2_repo_id=pulp2_importer_repo_id
pulp2_repo_id=pulp2_importer_repo_id,
not_in_plan=False
)
pulp3_remote = pulp2_importer.pulp3_remote
except Pulp2Importer.DoesNotExist:
Expand Down Expand Up @@ -221,6 +222,7 @@ def complex_repo_migration(plugin, pulp3_repo_setup, repo_name):
else:
pulp2dist = Pulp2Distributor.objects.filter(
is_migrated=False,
not_in_plan=False,
pulp2_repo_id__in=dist_repositories,
pulp2_type_id__in=distributor_types,
)
Expand Down
2 changes: 1 addition & 1 deletion pulp_2to3_migration/app/pre_migration.py
Expand Up @@ -591,7 +591,7 @@ def mark_removed_resources(plan, type_to_repo_ids):
removed_dists = []
for pulp2dist in Pulp2Distributor.objects.filter(
pulp2_object_id__in=removed_dist_object_ids):
pulp2dist.not_in_pulp2 = True
pulp2dist.not_in_plan = True
removed_dists.append(pulp2dist)

Pulp2Distributor.objects.bulk_update(objs=removed_dists,
Expand Down

0 comments on commit 210bd49

Please sign in to comment.