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

Commit

Permalink
Use only complete publication so remigration knows if a new publicati…
Browse files Browse the repository at this point in the history
…on is needed.

backports #9295
https://pulp.plan.io/issues/9295

fixes #9296

(cherry picked from commit 2694fa5)
  • Loading branch information
goosemania committed Aug 26, 2021
1 parent b36e617 commit a474a32
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGES/9296.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed remigration of publications after an unsuccessful or interrupted run.
(backported from #9295)
4 changes: 2 additions & 2 deletions pulp_2to3_migration/app/plugin/deb/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ def migrate_to_pulp3(cls, pulp2distributor, repo_version):
if not repo_version:
repo = pulp2distributor.pulp2_repos.filter(not_in_plan=False, is_migrated=True)
repo_version = repo[0].pulp3_repository_version
publication = repo_version.publication_set.first()
publication = repo_version.publication_set.filter(complete=True).first()
if not publication:
# create publication
publish(repo_version.pk, simple=True, structured=True)
publication = repo_version.publication_set.first()
publication = repo_version.publication_set.filter(complete=True).first()

# create distribution
pulp2_config = pulp2distributor.pulp2_config
Expand Down
4 changes: 2 additions & 2 deletions pulp_2to3_migration/app/plugin/iso/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ def migrate_to_pulp3(cls, pulp2distributor, repo_version):
if not repo_version:
repo = pulp2distributor.pulp2_repos.filter(not_in_plan=False, is_migrated=True)
repo_version = repo[0].pulp3_repository_version
publication = repo_version.publication_set.first()
publication = repo_version.publication_set.filter(complete=True).first()
if not publication:
# create publication
publish('PULP_MANIFEST', repo_version.pk)
publication = repo_version.publication_set.first()
publication = repo_version.publication_set.filter(complete=True).first()
# create distribution
pulp2_config = pulp2distributor.pulp2_config
base_config = cls.parse_base_config(pulp2distributor, pulp2_config)
Expand Down
4 changes: 2 additions & 2 deletions pulp_2to3_migration/app/plugin/rpm/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def migrate_to_pulp3(cls, pulp2distributor, repo_version):
if not repo_version:
repo = pulp2distributor.pulp2_repos.filter(not_in_plan=False, is_migrated=True)
repo_version = repo[0].pulp3_repository_version
publication = repo_version.publication_set.first()
publication = repo_version.publication_set.filter(complete=True).first()
if not publication:
pulp2_checksum_type = pulp2_config.get('checksum_type')
checksum_types = None
Expand All @@ -92,7 +92,7 @@ def migrate_to_pulp3(cls, pulp2distributor, repo_version):
except TypeError:
# hack, pulp_rpm <3.9 doesn't support sqlite_metadata kwarg
publish(repo_version.pk, checksum_types=checksum_types)
publication = repo_version.publication_set.first()
publication = repo_version.publication_set.filter(complete=True).first()

# create distribution
distribution_data = cls.parse_base_config(pulp2distributor, pulp2_config)
Expand Down

0 comments on commit a474a32

Please sign in to comment.