Skip to content

Commit

Permalink
draft/wip init_labels issue (test_sync_signatures)
Browse files Browse the repository at this point in the history
  • Loading branch information
git-hyagi committed Apr 17, 2024
1 parent 2a43e09 commit 02ea286
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pulp_container/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ def init_labels(self):
if self.config_blob:
try:
# if config-blob is stored in the database
self.labels = json.loads(self.config_blob.config_blob.instance.data)['config']['Labels'] or {}
config = json.loads(self.config_blob.config_blob.instance.data)['config']
if "Labels" in config.keys():
self.labels = config["Labels"] or {}
except:
# if not, we'll retrieve the config from file
config_artifact = self.config_blob._artifacts.get()
Expand Down
13 changes: 13 additions & 0 deletions pulp_container/app/tasks/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ def get_or_create_blob(layer_json, manifest, path):
ContentArtifact(
artifact=layer_artifact, content=blob, relative_path=layer_json["digest"]
).save()
#if layer_json["mediaType"] in [MEDIA_TYPE.CONFIG_BLOB_OCI, MEDIA_TYPE.CONFIG_BLOB]:
# with open(layer_file_name, "r") as content_file:
# raw_data = content_file.read()
# blob.data = raw_data
# blob.save()
#else:
# layer_artifact = Artifact.init_and_validate(layer_file_name)
# layer_artifact.save()
# ContentArtifact(
# artifact=layer_artifact, content=blob, relative_path=layer_json["digest"]
# ).save()
# BlobManifest(manifest=manifest, manifest_blob=blob).save()

if layer_json["mediaType"] != MEDIA_TYPE.CONFIG_BLOB_OCI:
BlobManifest(manifest=manifest, manifest_blob=blob).save()
return blob
Expand Down

0 comments on commit 02ea286

Please sign in to comment.