Skip to content

Commit

Permalink
Fix signature tests
Browse files Browse the repository at this point in the history
fixes: pulp#1035
  • Loading branch information
gerrod3 committed Jun 15, 2022
1 parent bfbe1ce commit 2a94ce4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES/1035.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed signature task to use new pulpcore 3.20 methods.
7 changes: 5 additions & 2 deletions pulp_ansible/app/tasks/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ def import_collection(
artifact_file, filename=filename, file_url=url, logger=user_facing_logger
)
artifact = Artifact.from_pulp_temporary_file(temp_file)
temp_file = None
importer_result["artifact_url"] = reverse("artifacts-detail", args=[artifact.pk])
collection_version = create_collection_from_importer(importer_result)
collection_version.manifest = manifest_data
Expand All @@ -318,11 +319,13 @@ def import_collection(

except ImporterError as exc:
log.info(f"Collection processing was not successful: {exc}")
temp_file.delete()
if temp_file:
temp_file.delete()
raise
except Exception as exc:
user_facing_logger.error(f"Collection processing was not successful: {exc}")
temp_file.delete()
if temp_file:
temp_file.delete()
raise

ContentArtifact.objects.create(
Expand Down
4 changes: 2 additions & 2 deletions pulp_ansible/app/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from rest_framework.parsers import FormParser, MultiPartParser
from rest_framework.serializers import ValidationError as DRFValidationError

from pulpcore.plugin.actions import ModifyRepositoryActionMixin
from pulpcore.plugin.actions import ModifyRepositoryActionMixin, raise_for_unknown_content_units
from pulpcore.plugin.exceptions import DigestValidationError
from pulpcore.plugin.models import PulpTemporaryFile, RepositoryVersion
from pulpcore.plugin.serializers import AsyncOperationResponseSerializer
Expand Down Expand Up @@ -357,7 +357,7 @@ def sign(self, request, pk):
content_units[NamedModelViewSet.extract_pk(url)] = url
content_units_pks = list(content_units.keys())
existing_content_units = CollectionVersion.objects.filter(pk__in=content_units_pks)
self.verify_content_units(existing_content_units, content_units)
raise_for_unknown_content_units(existing_content_units, content_units)

result = dispatch(
sign,
Expand Down

0 comments on commit 2a94ce4

Please sign in to comment.