Blob Blame History Raw
From 9d268437f092167f5afeb93e970eb197c696a866 Mon Sep 17 00:00:00 2001
From: Matej Tyc <matyc@redhat.com>
Date: Wed, 30 Jun 2021 21:29:24 +0200
Subject: [PATCH 1/4] Fix shadowing of _

_, the established symbol for dummy return values,
conflicted with _, the establish symbol for gettext translations.
---
 org_fedora_oscap/ks/oscap.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/org_fedora_oscap/ks/oscap.py b/org_fedora_oscap/ks/oscap.py
index 2172293..b96b93b 100644
--- a/org_fedora_oscap/ks/oscap.py
+++ b/org_fedora_oscap/ks/oscap.py
@@ -445,7 +445,7 @@ def setup(self, storage, ksdata, payload):
 
         try:
             # just check that preferred content exists
-            _ = self.content_bringer.get_preferred_content(content)
+            self.content_bringer.get_preferred_content(content)
         except Exception as exc:
             self._terminate(str(exc))
             return

From 2e38bc81e925818b8985dc80a0004b94c1f9278e Mon Sep 17 00:00:00 2001
From: Matej Tyc <matyc@redhat.com>
Date: Wed, 30 Jun 2021 21:29:41 +0200
Subject: [PATCH 2/4] Fix conversion of fatal messages to strings

---
 org_fedora_oscap/ks/oscap.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/org_fedora_oscap/ks/oscap.py b/org_fedora_oscap/ks/oscap.py
index b96b93b..90e8dd4 100644
--- a/org_fedora_oscap/ks/oscap.py
+++ b/org_fedora_oscap/ks/oscap.py
@@ -460,7 +460,7 @@ def setup(self, storage, ksdata, payload):
                           if message.type == common.MESSAGE_TYPE_FATAL]
         if any(fatal_messages):
             msg_lines = [_("Wrong configuration detected!")]
-            msg_lines.extend(fatal_messages)
+            msg_lines.extend([m.text for m in fatal_messages])
             self._terminate("\n".join(msg_lines))
             return
 

From fc467d9699a3ede83a2117ca48fae8edb589f35b Mon Sep 17 00:00:00 2001
From: Matej Tyc <matyc@redhat.com>
Date: Wed, 30 Jun 2021 20:45:22 +0200
Subject: [PATCH 3/4] Streamline the code

Make get_preinst_content_path and get_raw_preinst_content_path
easier to compare.
---
 org_fedora_oscap/ks/oscap.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/org_fedora_oscap/ks/oscap.py b/org_fedora_oscap/ks/oscap.py
index 90e8dd4..d1b8c9e 100644
--- a/org_fedora_oscap/ks/oscap.py
+++ b/org_fedora_oscap/ks/oscap.py
@@ -325,8 +325,7 @@ def preinst_content_path(self):
         """Path to the pre-installation content file"""
 
         if self.content_type == "datastream":
-            return utils.join_paths(common.INSTALLATION_CONTENT_DIR,
-                                    self.content_name)
+            return self.raw_preinst_content_path
         elif self.content_type == "scap-security-guide":
             # SSG is not copied to the standard place
             return self.content_path

From ea8fc0ab6307a6b8381b18b26cb0c7ce3ff7f8b0 Mon Sep 17 00:00:00 2001
From: Matej Tyc <matyc@redhat.com>
Date: Wed, 30 Jun 2021 20:49:07 +0200
Subject: [PATCH 4/4] Fix an f-string that references incorrect variable

---
 org_fedora_oscap/content_discovery.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/org_fedora_oscap/content_discovery.py b/org_fedora_oscap/content_discovery.py
index 6393086..f6b4d27 100644
--- a/org_fedora_oscap/content_discovery.py
+++ b/org_fedora_oscap/content_discovery.py
@@ -243,9 +243,10 @@ def get_preferred_content(self, content):
         return preferred_content
 
     def get_preferred_tailoring(self, content):
-        if self._addon_data.tailoring_path:
-            if self._addon_data.tailoring_path != str(content.tailoring.relative_to(content.root)):
-                msg = f"Expected a tailoring {self.tailoring_path}, but it couldn't be found"
+        tailoring_path = self._addon_data.tailoring_path
+        if tailoring_path:
+            if tailoring_path != str(content.tailoring.relative_to(content.root)):
+                msg = f"Expected a tailoring {tailoring_path}, but it couldn't be found"
                 raise content_handling.ContentHandlingError(msg)
         return content.tailoring