Skip to content

Commit

Permalink
Fixed pulpcore deprecations (pulp#1389)
Browse files Browse the repository at this point in the history
[noissue]
  • Loading branch information
gerrod3 authored Mar 7, 2023
1 parent eda7dc1 commit 8ec918c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pulp_ansible/app/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from rest_framework.parsers import FormParser, MultiPartParser
from rest_framework.serializers import ValidationError as DRFValidationError

from pulpcore.plugin.actions import ModifyRepositoryActionMixin, raise_for_unknown_content_units
from pulpcore.plugin.actions import ModifyRepositoryActionMixin
from pulpcore.plugin.exceptions import DigestValidationError
from pulpcore.plugin.models import PulpTemporaryFile, RepositoryVersion
from pulpcore.plugin.serializers import AsyncOperationResponseSerializer
Expand All @@ -32,6 +32,7 @@
RepositoryVersionViewSet,
SingleArtifactContentUploadViewSet,
)
from pulpcore.plugin.util import extract_pk, raise_for_unknown_content_units
from pulp_ansible.app.galaxy.mixins import UploadGalaxyCollectionMixin
from .models import (
AnsibleCollectionDeprecated,
Expand Down Expand Up @@ -419,7 +420,7 @@ def sign(self, request, pk):
content_units_pks = ["*"]
else:
for url in content:
content_units[NamedModelViewSet.extract_pk(url)] = url
content_units[extract_pk(url)] = url
content_units_pks = list(content_units.keys())
existing_content_units = CollectionVersion.objects.filter(pk__in=content_units_pks)
raise_for_unknown_content_units(existing_content_units, content_units)
Expand Down Expand Up @@ -452,7 +453,7 @@ def _handle_mark_task(self, request, task_function):
content_units_pks = ["*"]
else:
for url in content:
content_units[NamedModelViewSet.extract_pk(url)] = url
content_units[extract_pk(url)] = url
content_units_pks = list(content_units.keys())
existing_content_units = CollectionVersion.objects.filter(pk__in=content_units_pks)
raise_for_unknown_content_units(existing_content_units, content_units)
Expand Down Expand Up @@ -689,7 +690,7 @@ def _process_config(self, config):
if entry.get("content") is not None:
r["content"] = []
for c in entry["content"]:
r["content"].append(NamedModelViewSet().extract_pk(c))
r["content"].append(extract_pk(c))
result.append(r)

return result, exclusive_resources, shared_resources

0 comments on commit 8ec918c

Please sign in to comment.