Blame SOURCES/oscap-anaconda-addon-null-http_content_url-PR_232.patch

266e55
From 58d4847dc4b55b9d4982be9505127679beca87c6 Mon Sep 17 00:00:00 2001
266e55
From: Matej Tyc <matyc@redhat.com>
266e55
Date: Wed, 18 Jan 2023 16:36:36 +0100
266e55
Subject: [PATCH 1/2] Handle the URL with missing ://
266e55
266e55
---
266e55
 org_fedora_oscap/content_discovery.py | 16 ++++++++++++----
266e55
 1 file changed, 12 insertions(+), 4 deletions(-)
266e55
266e55
diff --git a/org_fedora_oscap/content_discovery.py b/org_fedora_oscap/content_discovery.py
266e55
index 42c61e0..23fdafd 100644
266e55
--- a/org_fedora_oscap/content_discovery.py
266e55
+++ b/org_fedora_oscap/content_discovery.py
266e55
@@ -67,9 +67,14 @@ def content_uri(self):
266e55
 
266e55
     @content_uri.setter
266e55
     def content_uri(self, uri):
266e55
-        scheme, path = uri.split("://", 1)
266e55
-        self.content_uri_path = path
266e55
-        self.content_uri_scheme = scheme
266e55
+        scheme_and_maybe_path = uri.split("://")
266e55
+        if len(scheme_and_maybe_path) == 1:
266e55
+            msg = (
266e55
+                f"Invalid supplied content URL '{uri}', "
266e55
+                "use the 'scheme://path' form.")
266e55
+            raise KickstartValueError(msg)
266e55
+        self.content_uri_path = scheme_and_maybe_path[1]
266e55
+        self.content_uri_scheme = scheme_and_maybe_path[0]
266e55
 
266e55
     def fetch_content(self, what_if_fail, ca_certs_path=""):
266e55
         """
266e55
@@ -80,7 +85,10 @@ def fetch_content(self, what_if_fail, ca_certs_path=""):
266e55
                 should handle them in the calling layer.
266e55
             ca_certs_path: Path to the HTTPS certificate file
266e55
         """
266e55
-        self.content_uri = self._addon_data.content_url
266e55
+        try:
266e55
+            self.content_uri = self._addon_data.content_url
266e55
+        except Exception as exc:
266e55
+            what_if_fail(exc)
266e55
         shutil.rmtree(self.CONTENT_DOWNLOAD_LOCATION, ignore_errors=True)
266e55
         self.CONTENT_DOWNLOAD_LOCATION.mkdir(parents=True, exist_ok=True)
266e55
         fetching_thread_name = self._fetch_files(
266e55
266e55
From cbfdae4f43ade3ef982a967f3e2844e66db3f9a0 Mon Sep 17 00:00:00 2001
266e55
From: Matej Tyc <matyc@redhat.com>
266e55
Date: Wed, 18 Jan 2023 16:36:53 +0100
266e55
Subject: [PATCH 2/2] Stop fetching when there is an invalid profile
266e55
266e55
---
266e55
 org_fedora_oscap/gui/spokes/oscap.py | 2 ++
266e55
 1 file changed, 2 insertions(+)
266e55
266e55
diff --git a/org_fedora_oscap/gui/spokes/oscap.py b/org_fedora_oscap/gui/spokes/oscap.py
266e55
index d8e6ce2..54eae1e 100644
266e55
--- a/org_fedora_oscap/gui/spokes/oscap.py
266e55
+++ b/org_fedora_oscap/gui/spokes/oscap.py
266e55
@@ -469,6 +469,8 @@ def update_progress_label(msg):
266e55
         if self._addon_data.profile_id and not selected:
266e55
             # profile ID given, but it was impossible to select it -> invalid
266e55
             # profile ID given
266e55
+            with self._fetch_flag_lock:
266e55
+                self._fetching = False
266e55
             self._invalid_profile_id()
266e55
             return
266e55