Set a flag in the DeviceTree to indicate when we are in the process of populating the tree. In the UI exception handlers we only collect save-to-disk targets if the exception did not originate in DeviceTree.populate. --- gui.py | 14 +++++++++----- storage/devicetree.py | 10 ++++++++++ text.py | 14 +++++++++----- 3 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/gui.py b/gui.py index aa09bbb..12472f1 100755 --- a/gui.py +++ b/gui.py @@ -762,11 +762,15 @@ class SaveExceptionWindow:
store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
- try: - dests = anaconda.id.storage.exceptionDisks() - except Exception as e: - log.error("Error when probing exception disks: %s" % e) - dests = [] + dests = [] + if anaconda.id.storage.devicetree.populated: + try: + dests = anaconda.id.storage.exceptionDisks() + except Exception as e: + log.error("Error when probing exception disks: %s" % e) + else: + log.info("Storage configuration unknown; not probing for " + "exception disks")
if flags.livecdInstall: self.destCombo.remove_text(0) diff --git a/storage/devicetree.py b/storage/devicetree.py index ddbe917..209288f 100644 --- a/storage/devicetree.py +++ b/storage/devicetree.py @@ -194,6 +194,9 @@ class DeviceTree(object): self._devices = [] self._actions = []
+ # indicates whether or not the tree has been fully populated + self.populated = False + self.intf = intf self.exclusiveDisks = exclusive self.clearPartType = type @@ -1733,6 +1736,11 @@ class DeviceTree(object):
def populate(self): """ Locate all storage devices. """ + + # mark the tree as unpopulated so exception handlers can tell the + # exception originated while finding storage devices + self.populated = False + # each iteration scans any devices that have appeared since the # previous iteration old_devices = [] @@ -1760,6 +1768,8 @@ class DeviceTree(object): for dev in devices: self.addUdevDevice(dev)
+ self.populated = True + # After having the complete tree we make sure that the system # inconsistencies are ignored or resolved. self._handleInconsistencies() diff --git a/text.py b/text.py index 3d1c63d..624993a 100644 --- a/text.py +++ b/text.py @@ -249,11 +249,15 @@ class SaveExceptionWindow: toplevel.add(self.scpButton, 0, 2, (0, 0, 0, 1)) toplevel.add(buttons, 0, 3, growx=1)
- try: - self.dests = self.anaconda.id.storage.exceptionDisks() - except Exception as e: - log.error("Error when probing exception disks: %s" % e) - self.dests = [] + self.dests = [] + if self.anaconda.id.storage.devicetree.populated: + try: + self.dests = self.anaconda.id.storage.exceptionDisks() + except Exception as e: + log.error("Error when probing exception disks: %s" % e) + else: + log.info("Storage configuration unknown; not probing for " + "exception disks")
# If there aren't any local disks, don't set it to be the default. if len(self.dests) == 0:
--- storage/devicetree.py | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/storage/devicetree.py b/storage/devicetree.py index ddbe917..8668ebd 100644 --- a/storage/devicetree.py +++ b/storage/devicetree.py @@ -1787,6 +1787,9 @@ class DeviceTree(object): log.debug("setup of %s failed: %s" % (device.name, msg))
def getDeviceBySysfsPath(self, path): + if not path: + return None + found = None for device in self._devices: if device.sysfsPath == path: @@ -1796,6 +1799,9 @@ class DeviceTree(object): return found
def getDeviceByUuid(self, uuid): + if not uuid: + return None + found = None for device in self._devices: if device.uuid == uuid: @@ -1808,6 +1814,9 @@ class DeviceTree(object): return found
def getDeviceByLabel(self, label): + if not label: + return None + found = None for device in self._devices: _label = getattr(device.format, "label", None) @@ -1822,6 +1831,9 @@ class DeviceTree(object):
def getDeviceByName(self, name): log.debug("looking for device '%s'..." % name) + if not name: + return None + found = None for device in self._devices: if device.name == name:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Tue, 30 Jun 2009, David Lehman wrote:
Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list
Both patches look fine to me.
- -- David Cantrell dcantrell@redhat.com Red Hat / Honolulu, HI
anaconda-devel@lists.stg.fedoraproject.org