[PATCH] Skip exceptionDisks if exception originated in devtree.populate. (#497240)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:
-- 
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux