From 7dfeb5ec0513a58502eb83aa2900e7c5fb0d478e Mon Sep 17 00:00:00 2001 From: Watson Sato Date: Tue, 8 Sep 2020 11:29:57 +0200 Subject: [PATCH] Fix load of product platform mapping The product specific mappings were overriding the common mappings, instead of being merged with them. --- ssg/yaml.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ssg/yaml.py b/ssg/yaml.py index 22cf5bad66..d8856e52c9 100644 --- a/ssg/yaml.py +++ b/ssg/yaml.py @@ -13,6 +13,7 @@ PKG_MANAGER_TO_CONFIG_FILE, XCCDF_PLATFORM_TO_PACKAGE) from .constants import DEFAULT_UID_MIN +from .utils import merge_dicts try: from yaml import CSafeLoader as yaml_SafeLoader @@ -139,10 +140,11 @@ def open_raw(yaml_file): def open_environment(build_config_yaml, product_yaml): contents = open_raw(build_config_yaml) - # Load common platform package mappings, - # any specific mapping in product_yaml will override the default - contents["platform_package_overrides"] = XCCDF_PLATFORM_TO_PACKAGE contents.update(open_raw(product_yaml)) + platform_package_overrides = contents.get("platform_package_overrides", {}) + # Merge common platform package mappings, while keeping product specific mappings + contents["platform_package_overrides"] = merge_dicts(XCCDF_PLATFORM_TO_PACKAGE, + platform_package_overrides) contents.update(_get_implied_properties(contents)) return contents