File: environment.py

package info (click to toggle)
scap-security-guide 0.1.76-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 110,644 kB
  • sloc: xml: 241,883; sh: 73,777; python: 32,527; makefile: 27
file content (32 lines) | stat: -rw-r--r-- 1,125 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
Common functions for processing Environment in SSG
"""

from __future__ import absolute_import
from __future__ import print_function


from .products import load_product_yaml
from .yaml import open_raw


def open_environment(build_config_yaml_path, product_yaml_path, product_properties_path=None):
    """
    Opens and merges environment configurations from given YAML files.

    Args:
        build_config_yaml_path (str): The file path to the build configuration YAML file.
        product_yaml_path (str): The file path to the product YAML file.
        product_properties_path (str, optional): The directory path containing product properties
                                                 files. Defaults to None.

    Returns:
        dict: A dictionary containing the merged contents of the build configuration and product
              YAML files.
    """
    contents = open_raw(build_config_yaml_path)
    product = load_product_yaml(product_yaml_path)
    if product_properties_path:
        product.read_properties_from_directory(product_properties_path)
    contents.update(product)
    return contents