[anaconda/rhel7 3/4] Catch BootLoaderError when setting up bootloader (#1013474)
Brian C. Lane
bcl at redhat.com
Thu Oct 3 23:38:18 UTC 2013
From: "Brian C. Lane" <bcl at redhat.com>
If the bootloader setup fails we need catch the error and
display it to the user instead of raising it or ignoring it.
Resolves: rhbz#1013474
---
anaconda.spec.in | 2 +-
pyanaconda/ui/gui/spokes/custom.py | 11 ++++++++---
pyanaconda/ui/gui/spokes/storage.py | 3 ++-
pyanaconda/ui/tui/spokes/storage.py | 3 ++-
4 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/anaconda.spec.in b/anaconda.spec.in
index 664bd1b..bdcc72a 100644
--- a/anaconda.spec.in
+++ b/anaconda.spec.in
@@ -80,7 +80,7 @@ BuildRequires: s390utils-devel
%endif
Requires: anaconda-widgets = %{version}-%{release}
-Requires: python-blivet >= 0.18
+Requires: python-blivet >= 0.18.5
Requires: gnome-icon-theme-symbolic
Requires: python-meh >= %{mehver}
Requires: libreport-anaconda >= 2.0.21-1
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 6072649..37cc02b 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -37,6 +37,7 @@ from pyanaconda.i18n import _, N_, P_
from pyanaconda.product import productName, productVersion
from pyanaconda.threads import AnacondaThread, threadMgr
from pyanaconda.constants import THREAD_EXECUTE_STORAGE, THREAD_STORAGE, THREAD_CUSTOM_STORAGE_INIT
+from pyanaconda.bootloader import BootLoaderError
from blivet import devicefactory
from blivet.formats import device_formats
@@ -646,10 +647,14 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
self.storage.savePassphrase(device)
+ StorageChecker.errors = []
# set up bootloader and check the configuration
- self.storage.setUpBootLoader()
+ try:
+ self.storage.setUpBootLoader()
+ except BootLoaderError as e:
+ log.error("storage configuration failed: %s" % e)
+ StorageChecker.errors = str(e).split("\n")
- StorageChecker.errors = []
StorageChecker.run(self)
hubQ.send_ready("StorageSpoke", True)
@@ -2486,7 +2491,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
self._error = e
self.set_error(_("Not enough free space on selected disks."))
self.window.show_all()
- except StorageError as e:
+ except (StorageError, BootLoaderError) as e:
log.error("doAutoPartition failed: %s" % e)
self._reset_storage()
self._error = e
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index ab50072..2bc4a8b 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -63,6 +63,7 @@ from pyanaconda.product import productName
from pyanaconda.flags import flags
from pyanaconda.i18n import _, N_, P_
from pyanaconda import constants
+from pyanaconda.bootloader import BootLoaderError
from pykickstart.constants import *
@@ -391,7 +392,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
hubQ.send_message(self.__class__.__name__, _("Saving storage configuration..."))
try:
doKickstartStorage(self.storage, self.data, self.instclass)
- except StorageError as e:
+ except (StorageError, BootLoaderError) as e:
log.error("storage configuration failed: %s" % e)
StorageChecker.errors = str(e).split("\n")
hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py
index 79756b2..91d595f 100644
--- a/pyanaconda/ui/tui/spokes/storage.py
+++ b/pyanaconda/ui/tui/spokes/storage.py
@@ -34,6 +34,7 @@ from pyanaconda.kickstart import doKickstartStorage
from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.constants import THREAD_STORAGE, THREAD_STORAGE_WATCHER
from pyanaconda.i18n import _, P_
+from pyanaconda.bootloader import BootLoaderError
from pykickstart.constants import CLEARPART_TYPE_ALL, CLEARPART_TYPE_LINUX, CLEARPART_TYPE_NONE
@@ -251,7 +252,7 @@ class StorageSpoke(NormalTUISpoke):
print(_("Generating updated storage configuration"))
try:
doKickstartStorage(self.storage, self.data, self.instclass)
- except StorageError as e:
+ except (StorageError, BootLoaderError) as e:
log.error("storage configuration failed: %s" % e)
print _("storage configuration failed: %s") % e
self.errors = [str(e)]
--
1.8.3.1
More information about the anaconda-patches
mailing list