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

Commit

Permalink
Update total counter before migration of a content type starts.
Browse files Browse the repository at this point in the history
Also unified some names in the progress report.

closes #8621
https://pulp.plan.io/issues/8621
  • Loading branch information
goosemania committed Apr 23, 2021
1 parent 1ad1be5 commit c905641
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES/8621.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed `total` counters for content migration.
4 changes: 3 additions & 1 deletion pulp_2to3_migration/app/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ def migrate_content(plan, skip_corrupted=False):
pulp3_content=None
).count()

pb.total += num_to_migrate
pb.save()

# migrate
plugin.migrator.migrate_content_to_pulp3(skip_corrupted=skip_corrupted)

pb.total += num_to_migrate
pb.done = pb.total
pb.save()

Expand Down
3 changes: 1 addition & 2 deletions pulp_2to3_migration/app/plugin/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,7 @@ def get_remote_by_importer_id(importer_id):
pulp_2to3_detail_qs = pulp_2to3_detail_qs.order_by('repo_id')

with ProgressReport(
message='Migrating {} content to Pulp 3 {}'.format(self.migrator.pulp2_plugin,
content_type),
message='Migrating {} content to Pulp 3'.format(content_type),
code='migrating.{}.content'.format(self.migrator.pulp2_plugin),
total=pulp_2to3_detail_qs.count()
) as pb:
Expand Down
4 changes: 2 additions & 2 deletions pulp_2to3_migration/app/pre_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ def delete_removed_pulp2_content(content_model):
total=total_content))

pulp2content_pb = ProgressReport(
message='Pre-migrating Pulp 2 {} content (general info)'.format(content_type.upper()),
message='Pre-migrating Pulp 2 {} content (general info)'.format(content_type),
code='premigrating.content.general',
total=total_content,
state=TASK_STATES.RUNNING)
pulp2content_pb.save()
pulp2detail_pb = ProgressReport(
message='Pre-migrating Pulp 2 {} content (detail info)'.format(content_type.upper()),
message='Pre-migrating Pulp 2 {} content (detail info)'.format(content_type),
code='premigrating.content.detail',
total=total_content,
state=TASK_STATES.RUNNING)
Expand Down

0 comments on commit c905641

Please sign in to comment.