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

Commit

Permalink
Migrate empty repos if specified in the migration plan
Browse files Browse the repository at this point in the history
  • Loading branch information
dralley committed Feb 7, 2020
1 parent e555bd8 commit 523cb5c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/6070.bugfix
@@ -0,0 +1 @@
Migrate empty repos if the migration plan specifies them.
10 changes: 8 additions & 2 deletions pulp_2to3_migration/app/tasks/migrate.py
Expand Up @@ -56,7 +56,7 @@ def get_repo_types(plan):
"""
repo_id_to_type = {}
type_to_repo_ids = defaultdict(list)
type_to_repo_ids = defaultdict(set)

# mapping content type -> plugin/repo type, e.g. 'docker_blob' -> 'docker'
content_type_to_plugin = {}
Expand All @@ -65,6 +65,12 @@ def get_repo_types(plan):
for content_type in plugin.migrator.pulp2_content_models:
content_type_to_plugin[content_type] = plugin.migrator.pulp2_plugin

repos = plugin.get_repositories()

for repo in repos:
repo_id_to_type[repo] = plugin.type
type_to_repo_ids[plugin.type].update(repos)

# TODO: optimizations.
# It looks at each content at the moment. Potential optimizations:
# - Filter by repos from the plan
Expand All @@ -79,7 +85,7 @@ def get_repo_types(plan):
continue
plugin_name = content_type_to_plugin[unit_type_id]
repo_id_to_type[repo_id] = plugin_name
type_to_repo_ids[plugin_name].append(repo_id)
type_to_repo_ids[plugin_name].add(repo_id)

return repo_id_to_type, type_to_repo_ids

Expand Down

0 comments on commit 523cb5c

Please sign in to comment.