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

Commit

Permalink
Fix distribution tree migration due to recent changes in the RPM plugin.
Browse files Browse the repository at this point in the history
Also fixes the case when a distribution tree is present in multiple repos.

closes #7206
https://pulp.plan.io/issues/7206

closes #6950
https://pulp.plan.io/issues/6950

(cherry picked from commit a62800b)
  • Loading branch information
goosemania committed Jul 24, 2020
1 parent e8b1de7 commit 6e39ce3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGES/6950.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed distribution tree migration when a distribution tree is present in multiple repositories.
1 change: 1 addition & 0 deletions CHANGES/7206.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix distribution tree migration issues caused by the model changes in the RPM plugin.
15 changes: 5 additions & 10 deletions pulp_2to3_migration/app/plugin/rpm/pulp_2to3_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from pulp_2to3_migration.app.models import (
Pulp2to3Content,
Pulp2Repository,
Pulp2RepoContent
)

Expand Down Expand Up @@ -721,19 +720,15 @@ def create_pulp3_content(self):
self.filename = namespace
treeinfo_parsed = treeinfo.parsed_sections()
treeinfo_serialized = TreeinfoData(treeinfo_parsed).to_dict(filename=namespace)
# The repository must already be migrated in order to migrate the DistributionTree
pulp2_r_c_unit = Pulp2RepoContent.objects.get(pulp2_unit_id=self.pulp2content.pulp2_id)
pulp2_repo_id = pulp2_r_c_unit.pulp2_repository.pulp2_repo_id
pulp2_repo = Pulp2Repository.objects.get(pulp2_repo_id=pulp2_repo_id, not_in_plan=False)
# Pulp 2 only knows about the top level kickstart repository
treeinfo_serialized["repositories"] = {'.': pulp2_repo.pulp3_repository.pk}
treeinfo_serialized["repositories"] = {'.': None}
# Pulp 2 did not support addon repositories, so we should not list them here either
treeinfo_serialized['addons'] = []
treeinfo_serialized['addons'] = {}
# Pulp 2 only supported variants that are in the root of the repository
variants = []
for variant in treeinfo_serialized['variants']:
variants = {}
for name, variant in treeinfo_serialized['variants'].items():
if variant['repository'] == '.':
variants.append(variant)
variants[name] = variant
treeinfo_serialized['variants'] = variants
# Reset build_timestamp so Pulp will fetch all the addons during the next sync
treeinfo_serialized['distribution_tree']['build_timestamp'] = 0
Expand Down

0 comments on commit 6e39ce3

Please sign in to comment.