From 7abf7eb400d2bc3f1a59225984e6a088b55bd107 Mon Sep 17 00:00:00 2001 From: Matej Tyc Date: Mon, 7 Jun 2021 15:25:47 +0200 Subject: [PATCH] Fied GUI installs. Anaconda will want to perform fetch, but if we install via GUI, a fetch has already been performed, and the addon should be able to acknowledge the work that has been done on the GUI side. --- org_fedora_oscap/ks/oscap.py | 6 +++++- org_fedora_oscap/model.py | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/org_fedora_oscap/ks/oscap.py b/org_fedora_oscap/ks/oscap.py index 223a8ab0..7146bbed 100644 --- a/org_fedora_oscap/ks/oscap.py +++ b/org_fedora_oscap/ks/oscap.py @@ -453,7 +453,11 @@ def setup(self, storage, ksdata, payload): self.model.content_uri = self.content_url thread_name = self.model.fetch_content(self.certificates, self._handle_error) - content = self.model.finish_content_fetch(thread_name, self.fingerprint, lambda msg: log.info(msg), self.raw_preinst_content_path, lambda content: content, self._handle_error) + content_dest = None + if self.content_type != "scap-security-guide": + content_dest = self.raw_preinst_content_path + + content = self.model.finish_content_fetch(thread_name, self.fingerprint, lambda msg: log.info(msg), content_dest, lambda content: content, self._handle_error) if not content: return diff --git a/org_fedora_oscap/model.py b/org_fedora_oscap/model.py index a5f81d2d..3c305c33 100644 --- a/org_fedora_oscap/model.py +++ b/org_fedora_oscap/model.py @@ -147,8 +147,12 @@ def _finish_actual_fetch(self, wait_for, fingerprint, report_callback, dest_file report_callback("Analyzing content.") if not actually_fetched_content: - fpaths = [f"{common.SSG_DIR}/{common.SSG_CONTENT}"] - labelled_files = content_handling.identify_files(fpaths) + if not dest_filename: # using scap-security-guide + fpaths = [f"{common.SSG_DIR}/{common.SSG_CONTENT}"] + labelled_files = content_handling.identify_files(fpaths) + else: # Using downloaded XCCDF/OVAL/DS/tailoring + fpaths = glob(str(self.CONTENT_DOWNLOAD_LOCATION / "*.xml")) + labelled_files = content_handling.identify_files(fpaths) else: dest_filename = pathlib.Path(dest_filename) # RPM is an archive at this phase