|
|
fd2bce |
From eb5c75eb590ff2eeac6b8c4e93d4589920cc3a9a Mon Sep 17 00:00:00 2001
|
|
|
fd2bce |
From: Vratislav Podzimek <vpodzime@redhat.com>
|
|
|
fd2bce |
Date: Tue, 7 Jul 2015 15:28:09 +0200
|
|
|
fd2bce |
Subject: [PATCH 2/7] Properly react on download/loading issues in
|
|
|
fd2bce |
text+kickstart mode
|
|
|
fd2bce |
|
|
|
fd2bce |
Instead of raising an exception in case of content download or loading issues we
|
|
|
fd2bce |
should let users know and give them a chance to continue anyway (if possible).
|
|
|
fd2bce |
|
|
|
fd2bce |
Related: rhbz#1240710
|
|
|
fd2bce |
Signed-off-by: Vratislav Podzimek <vpodzime@redhat.com>
|
|
|
fd2bce |
---
|
|
|
fd2bce |
org_fedora_oscap/ks/oscap.py | 31 +++++++++++++++++++++++++++++--
|
|
|
fd2bce |
1 file changed, 29 insertions(+), 2 deletions(-)
|
|
|
fd2bce |
|
|
|
fd2bce |
diff --git a/org_fedora_oscap/ks/oscap.py b/org_fedora_oscap/ks/oscap.py
|
|
|
fd2bce |
index fd57b14..ed0e54d 100644
|
|
|
fd2bce |
--- a/org_fedora_oscap/ks/oscap.py
|
|
|
fd2bce |
+++ b/org_fedora_oscap/ks/oscap.py
|
|
|
fd2bce |
@@ -23,10 +23,14 @@
|
|
|
fd2bce |
import shutil
|
|
|
fd2bce |
import re
|
|
|
fd2bce |
import os
|
|
|
fd2bce |
+import time
|
|
|
fd2bce |
|
|
|
fd2bce |
from pyanaconda.addons import AddonData
|
|
|
fd2bce |
from pyanaconda.iutil import getSysroot
|
|
|
fd2bce |
+from pyanaconda.progress import progressQ
|
|
|
fd2bce |
+from pyanaconda import errors
|
|
|
fd2bce |
from pyanaconda import iutil
|
|
|
fd2bce |
+from pyanaconda import flags
|
|
|
fd2bce |
from pykickstart.errors import KickstartParseError, KickstartValueError
|
|
|
fd2bce |
from org_fedora_oscap import utils, common, rule_handling, data_fetch
|
|
|
fd2bce |
from org_fedora_oscap.common import SUPPORTED_ARCHIVES
|
|
|
fd2bce |
@@ -35,6 +39,9 @@ from org_fedora_oscap.content_handling import ContentCheckError
|
|
|
fd2bce |
import logging
|
|
|
fd2bce |
log = logging.getLogger("anaconda")
|
|
|
fd2bce |
|
|
|
fd2bce |
+import gettext
|
|
|
fd2bce |
+_ = lambda x: gettext.ldgettext("oscap-anaconda-addon", x)
|
|
|
fd2bce |
+
|
|
|
fd2bce |
# export OSCAPdata class to prevent Anaconda's collect method from taking
|
|
|
fd2bce |
# AddonData class instead of the OSCAPdata class
|
|
|
fd2bce |
# @see: pyanaconda.kickstart.AnacondaKSHandler.__init__
|
|
|
fd2bce |
@@ -406,9 +413,29 @@ class OSCAPdata(AddonData):
|
|
|
fd2bce |
# content not available/fetched yet
|
|
|
fd2bce |
try:
|
|
|
fd2bce |
self._fetch_content_and_initialize()
|
|
|
fd2bce |
- except common.OSCAPaddonError:
|
|
|
fd2bce |
+ except common.OSCAPaddonError as e:
|
|
|
fd2bce |
log.error("Failed to fetch and initialize SCAP content!")
|
|
|
fd2bce |
- return
|
|
|
fd2bce |
+ msg = _("There was an error fetching and loading the security content:\n" +
|
|
|
fd2bce |
+ "%s\n" +
|
|
|
fd2bce |
+ "The installation should be aborted. Do you wish to continue anyway?") % e
|
|
|
fd2bce |
+
|
|
|
fd2bce |
+ if flags.flags.automatedInstall and not flags.flags.ksprompt:
|
|
|
fd2bce |
+ # cannot have ask in a non-interactive kickstart installation
|
|
|
fd2bce |
+ raise errors.CmdlineError(msg)
|
|
|
fd2bce |
+
|
|
|
fd2bce |
+ answ = errors.errorHandler.ui.showYesNoQuestion(msg)
|
|
|
fd2bce |
+ if answ == errors.ERROR_CONTINUE:
|
|
|
fd2bce |
+ # prevent any futher actions here by switching to the dry
|
|
|
fd2bce |
+ # run mode and let things go on
|
|
|
fd2bce |
+ self.dry_run = True
|
|
|
fd2bce |
+ return
|
|
|
fd2bce |
+ else:
|
|
|
fd2bce |
+ # Let's sleep forever to prevent any further actions and wait for
|
|
|
fd2bce |
+ # the main thread to quit the process.
|
|
|
fd2bce |
+ progressQ.send_quit(1)
|
|
|
fd2bce |
+ while True:
|
|
|
fd2bce |
+ time.sleep(100000)
|
|
|
fd2bce |
+
|
|
|
fd2bce |
|
|
|
fd2bce |
# check fingerprint if given
|
|
|
fd2bce |
if self.fingerprint:
|
|
|
fd2bce |
--
|
|
|
fd2bce |
2.4.3
|
|
|
fd2bce |
|