-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the ssg connections from utils to cac transformer
Signed-off-by: Sophia Wang <[email protected]>
- Loading branch information
1 parent
4343fe4
commit 83f4539
Showing
3 changed files
with
21 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright (c) 2024 Red Hat, Inc. | ||
|
||
"""Cac content Transformer for rule authoring. """ | ||
|
||
from ssg.products import load_product_yaml, product_yaml_path | ||
|
||
|
||
def get_component_title(product_name: str, cac_path: str) -> str: | ||
"""Get the product name from product yml file via the SSG library.""" | ||
if product_name and cac_path: | ||
# Get the product yaml file path | ||
product_yml_path = product_yaml_path(cac_path, product_name) | ||
# Load the product data | ||
product = load_product_yaml(product_yml_path) | ||
# Return product name from product yml file | ||
return product._primary_data.get("product") | ||
else: | ||
raise ValueError("component_title is empty or None") |