Blame SOURCES/scap-security-guide-0.1.53-fix-platform-to-package-mapping_PR_6059.patch

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