Skip to content

Commit

Permalink
Fixed 'sha'-using repos by teaching one more place to normalize check…
Browse files Browse the repository at this point in the history
…sum-type.

Test coverage is:
```
$ export FIPS_WORKFLOW=true
$ export CDN_CLIENT_CERT=`cat /PATH/TO/YOUR/cdn.crt`
$ export CDN_CLIENT_KEY=`cat /PATH/TO/YOUR/cdn.key`
$ export CDN_CA_CERT=`cat /PATH/TO/YOUR/redhat-uep.pem`
$ pulpcore-manager test pulp_rpm.tests.functional.api.test_fips_workflow.FipsRemotesTestCase.test_077_cdn_redhat_com_content_dist_rhel_server_6_6_6_x86_64_os
```

backports #9580
[nocoverage]

fixes #9625

(cherry picked from commit 3df6a5e)
  • Loading branch information
dralley committed Dec 21, 2021
1 parent aded4db commit 9493d73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES/9625.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed sync of repositories using 'sha' as an alias for the sha1 checksum-type.
(backported from #9580)
5 changes: 3 additions & 2 deletions pulp_rpm/app/tasks/synchronizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,8 @@ async def parse_repository_metadata(self, repomd, metadata_results, file_extensi
if should_skip:
continue

file_data = {record.checksum_type: record.checksum, "size": record.size}
sanitized_checksum_type = getattr(CHECKSUM_TYPES, record.checksum_type.upper())
file_data = {sanitized_checksum_type: record.checksum, "size": record.size}
da = DeclarativeArtifact(
artifact=Artifact(**file_data),
url=urlpath_sanitize(self.remote_url, record.location_href),
Expand All @@ -845,7 +846,7 @@ async def parse_repository_metadata(self, repomd, metadata_results, file_extensi
)
repo_metadata_file = RepoMetadataFile(
data_type=record.type,
checksum_type=record.checksum_type,
checksum_type=sanitized_checksum_type,
checksum=record.checksum,
relative_path=record.location_href,
)
Expand Down

0 comments on commit 9493d73

Please sign in to comment.