Skip to content

Commit

Permalink
Prep for deletion of legacy *_checksum_types options
Browse files Browse the repository at this point in the history
Zero-downtime migrations make things difficult

[noissue]
  • Loading branch information
dralley committed Aug 7, 2024
1 parent 8329d5e commit 517cac1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pulp_rpm/app/models/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class RpmRepository(Repository, AutoAddObjPermsMixin):
RpmPackageSigningService, on_delete=models.SET_NULL, null=True
)
package_signing_fingerprint = models.TextField(null=True, max_length=40)
original_checksum_types = models.JSONField(default=dict) # DEPRECATED, remove in 3.27+
original_checksum_types = models.JSONField(default=dict) # DEPRECATED, remove in 3.29+
last_sync_details = models.JSONField(default=dict)
retain_package_versions = models.PositiveIntegerField(default=0)

Expand Down
14 changes: 10 additions & 4 deletions pulp_rpm/app/tasks/publishing.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class PublicationData:
"""

def __init__(self, publication):
def __init__(self, publication, checksum_types):
"""
Setting Publication data.
Expand All @@ -70,6 +70,7 @@ def __init__(self, publication):
self.publication = publication
self.sub_repos = []
self.repomdrecords = []
self.checksum_types = checksum_types

def prepare_metadata_files(self, content, folder=None):
"""
Expand Down Expand Up @@ -260,7 +261,6 @@ def handle_sub_repos(self, distribution_tree):
(
addon_or_variant_id,
repository_version.content,
self.checksum_types,
)
)

Expand Down Expand Up @@ -290,7 +290,7 @@ def populate(self):
for name, content in self.sub_repos:
os.mkdir(name)
setattr(self, f"{name}_content", content)
setattr(self, f"{name}_checksums", checksum_types)
setattr(self, f"{name}_checksums", self.checksum_types)
setattr(self, f"{name}_repomdrecords", self.prepare_metadata_files(content, name))
self.publish_artifacts(content, prefix=name)

Expand Down Expand Up @@ -325,8 +325,11 @@ def publish(
repository_version_pk,
metadata_signing_service=None,
checksum_types=None,
checksum_type=None,
repo_config=None,
compression_type=COMPRESSION_TYPES.GZ,
*args,
**kwargs,
):
"""
Create a Publication based on a RepositoryVersion.
Expand All @@ -344,6 +347,9 @@ def publish(
repository_version = RepositoryVersion.objects.get(pk=repository_version_pk)
repository = repository_version.repository.cast()
checksum_types = checksum_types or {}
# currently unused, but prep for eliminating "checksum_types due to zero-downtime requirements"
if checksum_type:
checksum_types = {"general": checksum_type}

if metadata_signing_service:
metadata_signing_service = AsciiArmoredDetachedSigningService.objects.get(
Expand All @@ -365,7 +371,7 @@ def publish(
publication.compression_type = compression_type
publication.repo_config = repo_config

publication_data = PublicationData(publication)
publication_data = PublicationData(publication, checksum_types)
publication_data.populate()

total_repos = 1 + len(publication_data.sub_repos)
Expand Down

0 comments on commit 517cac1

Please sign in to comment.