From cb75c1220e43e2695a10145a31c9f1a22b63de2e Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 14 Nov 2024 11:01:40 +0100 Subject: [PATCH] Skip invalid containers with a warning - instead of breaking publishing, loader, inventory, etc. --- client/ayon_maya/api/pipeline.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/client/ayon_maya/api/pipeline.py b/client/ayon_maya/api/pipeline.py index 84268cc6..bfc01a48 100644 --- a/client/ayon_maya/api/pipeline.py +++ b/client/ayon_maya/api/pipeline.py @@ -347,11 +347,18 @@ def parse_container(container): container (str): A container node name. Returns: - dict: The container schema data for this container node. + dict[str, Any]: The container schema data for this container node. """ data = lib.read(container) + required = ["id", "name", "namespace", "loader", "representation"] + missing = [key for key in required if key not in data] + if missing: + log.warning("Container '%s' is missing required keys: %s", + container, missing) + return {} + # Backwards compatibility pre-schemas for containers data["schema"] = data.get("schema", "openpype:container-1.0") @@ -411,12 +418,14 @@ def ls(): they are called 'containers' Yields: - dict: container + dict[str, Any]: container """ container_names = _ls() for container in sorted(container_names): - yield parse_container(container) + container_data = parse_container(container) + if container_data: + yield container_data def containerise(name,