Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Moustafa-Moustafa committed Feb 25, 2025
1 parent e6dd715 commit d3fe10e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions pulp_file/app/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class FilePublicationSerializer(PublicationSerializer):
required=False,
allow_null=True,
)
checkpoint = serializers.BooleanField(default=False)
checkpoint = serializers.BooleanField(required=False)

class Meta:
model = FilePublication
Expand All @@ -134,7 +134,7 @@ class FileDistributionSerializer(DistributionSerializer):
queryset=models.Publication.objects.exclude(complete=False),
allow_null=True,
)
checkpoint = serializers.BooleanField(default=False)
checkpoint = serializers.BooleanField(required=False)

class Meta:
fields = DistributionSerializer.Meta.fields + ("publication", "checkpoint")
Expand Down
1 change: 1 addition & 0 deletions pulp_file/app/tasks/publishing.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def publish(manifest, repository_version_pk, checkpoint=False):
Args:
manifest (str): Filename to use for manifest file.
repository_version_pk (str): Create a publication from this repository version.
checkpoint (bool): Whether to create a checkpoint publication.
"""
repo_version = RepositoryVersion.objects.get(pk=repository_version_pk)
Expand Down
9 changes: 4 additions & 5 deletions pulp_file/app/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,13 @@ def create(self, request):
manifest = serializer.validated_data.get("manifest")
checkpoint = serializer.validated_data.get("checkpoint")

kwargs = {"repository_version_pk": str(repository_version.pk), "manifest": manifest}
if checkpoint:
kwargs["checkpoint"] = True
result = dispatch(
tasks.publish,
shared_resources=[repository_version.repository],
kwargs={
"repository_version_pk": str(repository_version.pk),
"manifest": manifest,
"checkpoint": checkpoint,
},
kwargs=kwargs,
)
return OperationPostponedResponse(result, request)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
("core", "0128_domain_pulp_labels"),
("core", "0129_content_pulp_labels"),
]

operations = [
Expand Down
6 changes: 2 additions & 4 deletions pulpcore/tests/functional/api/using_plugin/test_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,8 @@ def test_checkpoint_artifact_is_served(self, setup, http_get, checkpoint_url):

assert pub_2_response == pub_1_response
lines = pub_1_response.strip().split("\n")
artifact_names = [line.split(",")[0] for line in lines]
assert len(artifact_names) == 2
assert "0" in artifact_names
assert "1" in artifact_names
artifact_names = {line.split(",")[0] for line in lines}
assert artifact_names == {"0", "1"}

@pytest.mark.parallel
def test_non_checkpoint_timestamp_is_redirected(self, setup, http_get, checkpoint_url):
Expand Down

0 comments on commit d3fe10e

Please sign in to comment.