Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR feedback #9

Open
wants to merge 1 commit into
base: main_updated
Choose a base branch
from
Open
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: 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