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

Use checksum type of a package for publication if it's not configured. #380

Merged
merged 1 commit into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES/8725.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Ensure a checksum type of a package is used for publications when a checksum type was not explicitly configured in Pulp 2.

If you plan to perform sync from the migrated Pulp 3 to a Pulp 2 instance, this fix is important, otherwise you can ignore it.
If you've already started migration of the RPM plugin to Pulp 3, reset the migration for it and start again.
17 changes: 15 additions & 2 deletions pulp_2to3_migration/app/plugin/rpm/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,21 @@ def migrate_to_pulp3(cls, pulp2distributor, repo_version):
pulp2_checksum_type = pulp2_config.get('checksum_type')
checksum_types = None
if pulp2_checksum_type:
checksum_types = {'metadata': pulp2_checksum_type,
'package': pulp2_checksum_type}
checksum_types = {
'metadata': pulp2_checksum_type,
'package': pulp2_checksum_type
}
else:
# Set the checksum type based on content in a repo, pulp 2 supports only one
# checksum type for packages in a repo. It is important to set checksum type for
# Pulp 3 to Pulp 2 sync use case.
package_qs = repo_version.content.filter(pulp_type='rpm.package')
if package_qs.count():
pkg_checksum_type = package_qs.first().cast().checksum_type
checksum_types = {
'metadata': pkg_checksum_type,
'package': pkg_checksum_type
}
sqlite = pulp2_config.get('generate_sqlite', False)
try:
publish(repo_version.pk, checksum_types=checksum_types, sqlite_metadata=sqlite)
Copy link
Contributor

@dralley dralley Jun 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can get rid of the "hack" now (below)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will go into 0.11, so I'd leave the hack.
We can remove it after we merge compatibility PRs for 3.13.

Expand Down