From f57072a9e59f8f40bd2a9d5fd8a108d4008e8e8c Mon Sep 17 00:00:00 2001 From: David Parker Date: Mon, 18 Nov 2024 09:07:22 +0000 Subject: [PATCH] [patch] Fix handling when catalog does not exist --- src/mas/devops/data/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mas/devops/data/__init__.py b/src/mas/devops/data/__init__.py index 29038812..ae33168b 100644 --- a/src/mas/devops/data/__init__.py +++ b/src/mas/devops/data/__init__.py @@ -16,7 +16,12 @@ def getCatalog(name: str) -> dict: moduleFile = path.abspath(__file__) modulePath = path.dirname(moduleFile) catalogFileName = f"{name}.yaml" - with open(path.join(modulePath, "catalogs", catalogFileName)) as stream: + + pathToCatalog = path.join(modulePath, "catalogs", catalogFileName) + if not path.exists(pathToCatalog): + return None + + with open(pathToCatalog) as stream: return yaml.safe_load(stream)