[PATCH 1/2] Fix the botched helperization of StorageChecker
David Shea
dshea at redhat.com
Tue Dec 10 16:21:46 UTC 2013
Apparently I smashed "delete" a couple of times while modifying
checkStorage for use as an abstract base class. Also, StorageChecker
really does need to send messages for StorageSpoke and not whatever
class is implementing it, since CustomPartitioningSpoke is not on a hub.
Added a constructor parameter for the spoke name so StorageChecker isn't
totally GUI specific.
Also also I completely misinterpreted how CustomPartitioningSpoke and
StorageSpoke communicate errors via StorageChecker, so reverted that
part and made errors and warnings class attributes on StorageChecker
again.
---
pyanaconda/ui/gui/spokes/storage.py | 8 ++++----
pyanaconda/ui/helpers.py | 20 +++++++++++---------
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index d205f6b..177282b 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -405,7 +405,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
doKickstartStorage(self.storage, self.data, self.instclass)
except (StorageError, KickstartValueError) as e:
log.error("storage configuration failed: %s", e)
- self.errors = str(e).split("\n")
+ StorageChecker.errors = str(e).split("\n")
hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
self.data.bootloader.bootDrive = ""
self.data.ignoredisk.drives = []
@@ -417,14 +417,14 @@ class StorageSpoke(NormalSpoke, StorageChecker):
self._applyDiskSelection(self.selected_disks)
except BootLoaderError as e:
log.error("BootLoader setup failed: %s", e)
- self.errors = str(e).split("\n")
+ StorageChecker.errors = str(e).split("\n")
hubQ.send_message(self.__class__.__name__, _("Failed to save storage configuration..."))
self.data.bootloader.bootDrive = ""
else:
if self.autopart:
# this was already run as part of doAutoPartition. dumb.
- self.errors = []
- self.warnings = []
+ StorageChecker.errors = []
+ StorageChecker.warnings = []
self.run()
finally:
self._ready = True
diff --git a/pyanaconda/ui/helpers.py b/pyanaconda/ui/helpers.py
index decc6cf..b517412 100644
--- a/pyanaconda/ui/helpers.py
+++ b/pyanaconda/ui/helpers.py
@@ -69,10 +69,11 @@ class StorageChecker(object):
__metaclass__ = ABCMeta
log = logging.getLogger("anaconda")
+ errors = []
+ warnings = []
- def __init__(self):
- self.errors = []
- self.warnings = []
+ def __init__(self, mainSpokeClass="StorageSpoke"):
+ self._mainSpokeClass = mainSpokeClass
@abstractproperty
def storage(self):
@@ -85,13 +86,14 @@ class StorageChecker(object):
def checkStorage(self):
threadMgr.wait(constants.THREAD_EXECUTE_STORAGE)
- hubQ.send_not_read(self.__class__.__name__)
- hubQ.send_message(self.__class__.__name__, _("Check storage configuration..."))
- (self.errors,
- self.warnings) = self.storage.sanityCheck()
- for e in self.errors:
+ hubQ.send_not_ready(self._mainSpokeClass)
+ hubQ.send_message(self._mainSpokeClass, _("Checking storage configuration..."))
+ (StorageChecker.errors,
+ StorageChecker.warnings) = self.storage.sanityCheck()
+ hubQ.send_ready(self._mainSpokeClass, True)
+ for e in StorageChecker.errors:
self.log.error(e)
- for w in self.warnings:
+ for w in StorageChecker.warnings:
self.log.warn(w)
class SourceSwitchHandler(object):
--
1.8.4.2
More information about the anaconda-patches
mailing list