Skip to content

Commit

Permalink
Fix wrong checksum being used for publication
Browse files Browse the repository at this point in the history
backports: #8644
https://pulp.plan.io/issues/8644

fixes #8752

(cherry picked from commit f14be05)
  • Loading branch information
goosemania committed May 18, 2021
1 parent cd3eb8f commit cd22c67
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGES/8752.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed a bug where publication used the default metadata checksum type of SHA-256 rather than the one requested by the user.
(backported from #8644)
11 changes: 5 additions & 6 deletions pulp_rpm/app/tasks/publishing.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,11 @@ def get_checksum_type(name, checksum_types):
"""
original = checksum_types.get("original")
metadata = checksum_types.get("metadata")
checksum_type = original.get(name, CHECKSUM_TYPES.SHA256)

if metadata:
checksum_type = metadata

return getattr(cr, getattr(CHECKSUM_TYPES, checksum_type.upper()), cr.SHA256)
checksum_type = metadata if metadata else original.get(name, CHECKSUM_TYPES.SHA256)
# "sha" -> "SHA" -> "CHECKSUM_TYPES.SHA" -> "sha1"
normalized_checksum_type = getattr(CHECKSUM_TYPES, checksum_type.upper())
# "sha1" -> "SHA1" -> "cr.SHA1"
return getattr(cr, normalized_checksum_type.upper())


def publish(
Expand Down

0 comments on commit cd22c67

Please sign in to comment.