diff --git a/pulp_container/app/models.py b/pulp_container/app/models.py index a51bad846..f3d8a3ff6 100644 --- a/pulp_container/app/models.py +++ b/pulp_container/app/models.py @@ -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() diff --git a/pulp_container/app/tasks/builder.py b/pulp_container/app/tasks/builder.py index f18d574ac..e15f6052a 100644 --- a/pulp_container/app/tasks/builder.py +++ b/pulp_container/app/tasks/builder.py @@ -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