Skip to content

Commit

Permalink
draft/wip tarfile
Browse files Browse the repository at this point in the history
  • Loading branch information
git-hyagi committed Apr 4, 2024
1 parent b50f199 commit 45cab1e
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions pulp_container/app/registry_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import logging
import hashlib
import re
import tarfile

from aiohttp.client_exceptions import ClientResponseError
from itertools import chain
Expand Down Expand Up @@ -929,14 +930,23 @@ def put(self, request, path, pk=None):
artifact.touch()

blob = None
try:
if tarfile.is_tarfile(artifact.file):
blob = self.create_blob(artifact, digest)
repository.pending_blobs.add(blob)
else:
raw_manifest = artifact.file.read().decode("utf-8")
manifest = json.loads(raw_manifest)
blob = self.create_config_blob(manifest, raw_manifest, digest)
repository.pending_config_blobs.add(blob)
except UnicodeDecodeError:
blob = self.create_blob(artifact, digest)
repository.pending_blobs.add(blob)

#try:
# raw_manifest = artifact.file.read().decode("utf-8")
# manifest = json.loads(raw_manifest)
# blob = self.create_config_blob(manifest, raw_manifest, digest)
# repository.pending_config_blobs.add(blob)
#except UnicodeDecodeError:
# blob = self.create_blob(artifact, digest)
# repository.pending_blobs.add(blob)
upload.delete()

return BlobResponse(blob, path, 201, request)
Expand Down

0 comments on commit 45cab1e

Please sign in to comment.