Blame SOURCES/just_report_text_mode_1263207.patch

c5477d
From 0e3bfd1eb771802edab0d5f72dc7a9e8538f2fa7 Mon Sep 17 00:00:00 2001
c5477d
From: Vratislav Podzimek <vpodzime@redhat.com>
c5477d
Date: Tue, 17 May 2016 14:35:39 +0200
c5477d
Subject: [PATCH 04/13] Just report misconfiguration instead of crashing in
c5477d
 text mode
c5477d
c5477d
User should get to know what happened, but crashing and showing a traceback is
c5477d
not really a great way to do it. Showing a text "dialog" with all the
c5477d
information we have is much better.
c5477d
c5477d
Resolves: rhbz#1263207
c5477d
---
c5477d
 org_fedora_oscap/ks/oscap.py | 26 ++++++++++++++++++++++----
c5477d
 1 file changed, 22 insertions(+), 4 deletions(-)
c5477d
c5477d
diff --git a/org_fedora_oscap/ks/oscap.py b/org_fedora_oscap/ks/oscap.py
c5477d
index 5c29d4a..44c442f 100644
c5477d
--- a/org_fedora_oscap/ks/oscap.py
c5477d
+++ b/org_fedora_oscap/ks/oscap.py
c5477d
@@ -466,10 +466,28 @@ class OSCAPdata(AddonData):
c5477d
 
c5477d
         # evaluate rules, do automatic fixes and stop if something that cannot
c5477d
         # be fixed automatically is wrong
c5477d
-        messages = self.rule_data.eval_rules(ksdata, storage)
c5477d
-        if any(message.type == common.MESSAGE_TYPE_FATAL
c5477d
-               for message in messages):
c5477d
-            raise MisconfigurationError("Wrong configuration detected!")
c5477d
+        fatal_messages = [message for message in self.rule_data.eval_rules(ksdata, storage)
c5477d
+                          if message.type == common.MESSAGE_TYPE_FATAL]
c5477d
+        if any(fatal_messages):
c5477d
+            msg = "Wrong configuration detected!\n"
c5477d
+            msg += "\n".join(message.text for message in fatal_messages)
c5477d
+            msg += "\nThe installation should be aborted. Do you wish to continue anyway?"
c5477d
+            if flags.flags.automatedInstall and not flags.flags.ksprompt:
c5477d
+                # cannot have ask in a non-interactive kickstart installation
c5477d
+                raise errors.CmdlineError(msg)
c5477d
+
c5477d
+            answ = errors.errorHandler.ui.showYesNoQuestion(msg)
c5477d
+            if answ == errors.ERROR_CONTINUE:
c5477d
+                # prevent any futher actions here by switching to the dry
c5477d
+                # run mode and let things go on
c5477d
+                self.dry_run = True
c5477d
+                return
c5477d
+            else:
c5477d
+                # Let's sleep forever to prevent any further actions and wait for
c5477d
+                # the main thread to quit the process.
c5477d
+                progressQ.send_quit(1)
c5477d
+                while True:
c5477d
+                    time.sleep(100000)
c5477d
 
c5477d
         # add packages needed on the target system to the list of packages
c5477d
         # that are requested to be installed
c5477d
-- 
c5477d
2.5.5
c5477d