Skip to content

Commit

Permalink
draft
Browse files Browse the repository at this point in the history
  • Loading branch information
git-hyagi committed Oct 25, 2024
1 parent c1d0ba9 commit c172018
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pulp_container/app/tasks/sync_stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from pulpcore.plugin.stages import DeclarativeArtifact, DeclarativeContent, Stage, ContentSaver

from pulp_container.constants import (
MANIFEST_TYPE,
MEDIA_TYPE,
SIGNATURE_API_EXTENSION_VERSION,
SIGNATURE_HEADER,
Expand Down Expand Up @@ -287,9 +288,16 @@ async def resolve_flush(self):
self.manifest_dcs.clear()

for manifest_list_dc in self.manifest_list_dcs:
manifest_list_nature = MANIFEST_TYPE.UNKNOWN
for listed_manifest in manifest_list_dc.extra_data["listed_manifests"]:
# Just await here. They will be associated in the post_save hook.
await listed_manifest["manifest_dc"].resolution()
if listed_manifest["manifest_dc"].content.type in [
MANIFEST_TYPE.BOOTABLE,
MANIFEST_TYPE.FLATPAK,
]:
manifest_list_nature = listed_manifest["manifest_dc"].content.type
manifest_list_dc.content.type = manifest_list_nature
await self.put(manifest_list_dc)
self.manifest_list_dcs.clear()

Expand Down Expand Up @@ -644,8 +652,10 @@ def _post_save(self, batch):
if manifest_list_manifests:
ManifestListManifest.objects.bulk_create(manifest_list_manifests, ignore_conflicts=True)

# DEPRECATED: is_bootable/is_flatpak are deprecated and will be removed in a future release.
# keeping this block for now to avoid introducing a bug or a regression
# after creating the relation between listed manifests and manifest lists,
# it is possible to initialize the nature of the corresponding manifest lists
for ml in manifest_lists:
if ml.init_manifest_list_nature():
ml.save(update_fields=["is_bootable", "is_flatpak", "type"])
ml.save(update_fields=["is_bootable", "is_flatpak"])

0 comments on commit c172018

Please sign in to comment.