Skip to content

Commit

Permalink
feat: add new pre-commit hook: validate ibm_catalog.json inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
akocbekIBM committed Dec 17, 2024
1 parent a513e84 commit 7cc8e6f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions module-assets/ci/validateIbmCatalogJson.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ def check_ibm_catalog_file(da_name):
inputs = []
with open(IBM_CATALOG_FILE) as f:
ibm_catalog = json.load(f)
if ibm_catalog and ibm_catalog["products"]:
if ibm_catalog and "products" in ibm_catalog and ibm_catalog["products"]:
for product in ibm_catalog["products"]:
if product["flavors"]:
if "flavors" in ibm_catalog["products"] and product["flavors"]:
for flavor in product["flavors"]:
if (
flavor["working_directory"]
"working_directory" in flavor
and "configuration" in flavor
and flavor["working_directory"]
and flavor["working_directory"] == f"{DA_FOLDER}/{da_name}"
and flavor["configuration"]
):
Expand Down

0 comments on commit 7cc8e6f

Please sign in to comment.