Skip to content

Commit

Permalink
Merge pull request #1029 from ATIX-AG/switch_to_pulpcore
Browse files Browse the repository at this point in the history
Switch to NoArtifactContentViewSet from pulpcore
  • Loading branch information
quba42 authored Mar 25, 2024
2 parents 820d860 + 5170012 commit 106f148
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ cat >> vars/main.yaml << VARSYAML
pulp_env: {}
pulp_settings: {"allowed_content_checksums": ["md5", "sha1", "sha256", "sha512"], "allowed_export_paths": ["/tmp"], "allowed_import_paths": ["/tmp"]}
pulp_scheme: https
pulp_default_container: ghcr.io/pulp/pulp-ci-centos:latest
pulp_default_container: ghcr.io/pulp/pulp-ci-centos9:latest
VARSYAML

SCENARIOS=("pulp" "performance" "azure" "gcp" "s3" "generate-bindings" "lowerbounds")
Expand Down
1 change: 1 addition & 0 deletions CHANGES/1039.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dropped support for Python 3.8. pulp_deb now supports Python >=3.9.
36 changes: 1 addition & 35 deletions pulp_deb/app/viewsets/content.py
Original file line number Diff line number Diff line change
@@ -1,54 +1,20 @@
from gettext import gettext as _ # noqa

from django_filters import Filter
from drf_spectacular.utils import extend_schema
from pulpcore.plugin.tasking import general_create
from pulpcore.plugin.models import Repository, RepositoryVersion
from pulpcore.plugin.serializers import AsyncOperationResponseSerializer
from pulpcore.plugin.serializers.content import ValidationError
from pulpcore.plugin.tasking import dispatch
from pulpcore.plugin.viewsets import (
NAME_FILTER_OPTIONS,
ContentFilter,
ContentViewSet,
NamedModelViewSet,
OperationPostponedResponse,
NoArtifactContentViewSet,
SingleArtifactContentUploadViewSet,
)
from pulpcore.plugin.viewsets.content import DefaultDeferredContextMixin

from pulp_deb.app import models, serializers


class NoArtifactContentViewSet(DefaultDeferredContextMixin, ContentViewSet):
"""A ViewSet for content creation that does not require a file to be uploaded."""

@extend_schema(
description="Trigger an asynchronous task to create content,"
"optionally create new repository version.",
responses={202: AsyncOperationResponseSerializer},
)
def create(self, request):
"""Create a content unit."""
serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)

exclusive_resources = [
item for item in (serializer.validated_data.get(key) for key in ("repository",)) if item
]

task = dispatch(
general_create,
exclusive_resources=exclusive_resources,
args=(self.queryset.model._meta.app_label, serializer.__class__.__name__),
kwargs={
"data": {k: v for k, v in request.data.items()},
"context": self.get_deferred_context(request),
},
)
return OperationPostponedResponse(task, request)


class GenericContentFilter(ContentFilter):
"""
FilterSet for GenericContent.
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# All things django and asyncio are deliberately left to pulpcore
# Example transitive requirements: asgiref, asyncio, aiohttp
pulpcore>=3.45.1,<3.55
pulpcore>=3.49.0,<3.55
python-debian>=0.1.44,<0.2.0
python-gnupg>=0.5,<0.6
jsonschema>=4.6,<5.0
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
author="Matthias Dellweg",
author_email="[email protected]",
url="https://pulpproject.org",
python_requires=">=3.8",
python_requires=">=3.9",
install_requires=requirements,
include_package_data=True,
packages=find_packages(exclude=["tests", "tests.*"]),
Expand All @@ -29,8 +29,10 @@
"Framework :: Django",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
),
entry_points={"pulpcore.plugin": ["pulp_deb = pulp_deb:default_app_config"]},
)
2 changes: 1 addition & 1 deletion template_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ check_commit_message: true
check_gettext: true
check_manifest: true
check_stray_pulpcore_imports: true
ci_base_image: ghcr.io/pulp/pulp-ci-centos
ci_base_image: ghcr.io/pulp/pulp-ci-centos9
ci_env: {}
ci_trigger: '{pull_request: {branches: [''*'']}}'
ci_update_docs: true
Expand Down

0 comments on commit 106f148

Please sign in to comment.