Fix a reaction to invalid content URI
Resolves: rhbz#2148508
This commit is contained in:
parent
628b8c774e
commit
04562812c6
66
oscap-anaconda-addon-null-http_only_uri-PR_233.patch
Normal file
66
oscap-anaconda-addon-null-http_only_uri-PR_233.patch
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
From 5e91b77a0e96b811d95b7fa48cfd8f645a5616eb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Matej Tyc <matyc@redhat.com>
|
||||||
|
Date: Wed, 18 Jan 2023 16:36:36 +0100
|
||||||
|
Subject: [PATCH 1/2] Handle the URL with missing ://
|
||||||
|
|
||||||
|
---
|
||||||
|
org_fedora_oscap/content_discovery.py | 16 ++++++++++++----
|
||||||
|
1 file changed, 12 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/org_fedora_oscap/content_discovery.py b/org_fedora_oscap/content_discovery.py
|
||||||
|
index 61c4930..76959cd 100644
|
||||||
|
--- a/org_fedora_oscap/content_discovery.py
|
||||||
|
+++ b/org_fedora_oscap/content_discovery.py
|
||||||
|
@@ -88,9 +88,14 @@ def content_uri(self):
|
||||||
|
|
||||||
|
@content_uri.setter
|
||||||
|
def content_uri(self, uri):
|
||||||
|
- scheme, path = uri.split("://", 1)
|
||||||
|
- self.content_uri_path = path
|
||||||
|
- self.content_uri_scheme = scheme
|
||||||
|
+ scheme_and_maybe_path = uri.split("://")
|
||||||
|
+ if len(scheme_and_maybe_path) == 1:
|
||||||
|
+ msg = (
|
||||||
|
+ f"Invalid supplied content URL '{uri}', "
|
||||||
|
+ "use the 'scheme://path' form.")
|
||||||
|
+ raise KickstartValueError(msg)
|
||||||
|
+ self.content_uri_path = scheme_and_maybe_path[1]
|
||||||
|
+ self.content_uri_scheme = scheme_and_maybe_path[0]
|
||||||
|
|
||||||
|
def fetch_content(self, what_if_fail, ca_certs_path=""):
|
||||||
|
"""
|
||||||
|
@@ -101,7 +106,10 @@ def fetch_content(self, what_if_fail, ca_certs_path=""):
|
||||||
|
should handle them in the calling layer.
|
||||||
|
ca_certs_path: Path to the HTTPS certificate file
|
||||||
|
"""
|
||||||
|
- self.content_uri = self._addon_data.content_url
|
||||||
|
+ try:
|
||||||
|
+ self.content_uri = self._addon_data.content_url
|
||||||
|
+ except Exception as exc:
|
||||||
|
+ what_if_fail(exc)
|
||||||
|
shutil.rmtree(self.CONTENT_DOWNLOAD_LOCATION, ignore_errors=True)
|
||||||
|
self.CONTENT_DOWNLOAD_LOCATION.mkdir(parents=True, exist_ok=True)
|
||||||
|
fetching_thread_name = self._fetch_files(
|
||||||
|
|
||||||
|
From 9588cb840d8c6193157e677decad843539bd2819 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Matej Tyc <matyc@redhat.com>
|
||||||
|
Date: Wed, 18 Jan 2023 16:36:53 +0100
|
||||||
|
Subject: [PATCH 2/2] Stop fetching when there is an invalid profile
|
||||||
|
|
||||||
|
---
|
||||||
|
org_fedora_oscap/gui/spokes/oscap.py | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/org_fedora_oscap/gui/spokes/oscap.py b/org_fedora_oscap/gui/spokes/oscap.py
|
||||||
|
index 97c4553..7765fbf 100644
|
||||||
|
--- a/org_fedora_oscap/gui/spokes/oscap.py
|
||||||
|
+++ b/org_fedora_oscap/gui/spokes/oscap.py
|
||||||
|
@@ -505,6 +505,8 @@ def update_progress_label(msg):
|
||||||
|
if self._policy_data.profile_id and not selected:
|
||||||
|
# profile ID given, but it was impossible to select it -> invalid
|
||||||
|
# profile ID given
|
||||||
|
+ with self._fetch_flag_lock:
|
||||||
|
+ self._fetching = False
|
||||||
|
self._invalid_profile_id()
|
||||||
|
return
|
||||||
|
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
Name: oscap-anaconda-addon
|
Name: oscap-anaconda-addon
|
||||||
Version: 2.0.0
|
Version: 2.0.0
|
||||||
Release: 14%{?dist}
|
Release: 15%{?dist}
|
||||||
Summary: Anaconda addon integrating OpenSCAP to the installation process
|
Summary: Anaconda addon integrating OpenSCAP to the installation process
|
||||||
|
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
@ -33,6 +33,7 @@ Patch10: oscap-anaconda-addon-2.0.1-fix_strings-PR_207.patch
|
|||||||
Patch11: oscap-anaconda-addon-2.1.0-clicking_fix-PR_223.patch
|
Patch11: oscap-anaconda-addon-2.1.0-clicking_fix-PR_223.patch
|
||||||
Patch12: oscap-anaconda-addon-2.1.0-archive_handling-PR_224.patch
|
Patch12: oscap-anaconda-addon-2.1.0-archive_handling-PR_224.patch
|
||||||
Patch13: oscap-anaconda-addon-2.1.0-content_paths-PR_227.patch
|
Patch13: oscap-anaconda-addon-2.1.0-content_paths-PR_227.patch
|
||||||
|
Patch14: oscap-anaconda-addon-null-http_only_uri-PR_233.patch
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
BuildRequires: make
|
BuildRequires: make
|
||||||
@ -72,6 +73,10 @@ make install DESTDIR=%{buildroot}
|
|||||||
%doc COPYING ChangeLog README.md
|
%doc COPYING ChangeLog README.md
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jan 23 2023 Matej Tyc <matyc@redhat.com> - 2.0.0-15
|
||||||
|
- Fix a reaction to invalid content URI
|
||||||
|
Resolves: rhbz#2148508
|
||||||
|
|
||||||
* Fri Nov 25 2022 Matej Tyc <matyc@redhat.com> - 2.0.0-14
|
* Fri Nov 25 2022 Matej Tyc <matyc@redhat.com> - 2.0.0-14
|
||||||
- Fix regression introduced when fixing content archive input
|
- Fix regression introduced when fixing content archive input
|
||||||
Resolves: rhbz#2129008
|
Resolves: rhbz#2129008
|
||||||
|
Loading…
Reference in New Issue
Block a user