[PATCH f19/master] Prevent StorageSpoke.execute from running multiple times (#966761, #967527).

Chris Lumens clumens at redhat.com
Thu Jun 13 20:01:05 UTC 2013


The problem is that StorageSpoke.changed always returns true, which we want so
people can go back into the spoke and get the install options dialogs multiple
times.  However, we don't want the execute method to run every time some other
spoke sets storage to ready on kickstart installs.  This results in problems
like trying to fit two sets of autopart actions onto the same disks, for
instance.
---
 pyanaconda/ui/common.py            |  2 ++
 pyanaconda/ui/gui/hubs/__init__.py | 14 +++++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/ui/common.py b/pyanaconda/ui/common.py
index bc1009e..5248694 100644
--- a/pyanaconda/ui/common.py
+++ b/pyanaconda/ui/common.py
@@ -213,6 +213,8 @@ class Spoke(UIObject):
         self.instclass = instclass
         self.applyOnSkip = False
 
+        self._visitedSinceApplied = True
+
     @classmethod
     def should_run(cls, environment, data):
         """This method is responsible for beginning Spoke initialization.
diff --git a/pyanaconda/ui/gui/hubs/__init__.py b/pyanaconda/ui/gui/hubs/__init__.py
index 37daf47..c75bc74 100644
--- a/pyanaconda/ui/gui/hubs/__init__.py
+++ b/pyanaconda/ui/gui/hubs/__init__.py
@@ -120,9 +120,14 @@ class Hub(GUIObject, common.Hub):
         Gtk.main()
         action.window.set_transient_for(None)
 
+        action._visitedSinceApplied = True
+
+        # Don't take _visitedSinceApplied into account here.  It will always be
+        # True from the line above.
         if action.changed and (not action.skipTo or (action.skipTo and action.applyOnSkip)):
             action.apply()
             action.execute()
+            action._visitedSinceApplied = False
 
     def _collectCategoriesAndSpokes(self):
         """collects categories and spokes to be displayed on this Hub
@@ -210,8 +215,10 @@ class Hub(GUIObject, common.Hub):
                 spoke.selector.connect("key-release-event", self._on_spoke_clicked, spoke)
 
                 # If this is a kickstart install, attempt to execute any provided ksdata now.
-                if flags.automatedInstall and spoke.ready and spoke.changed:
+                if flags.automatedInstall and spoke.ready and spoke.changed and \
+                   spoke._visitedSinceApplied:
                     spoke.execute()
+                    spoke._visitedSinceApplied = False
 
                 selectors.append(spoke.selector)
 
@@ -331,8 +338,9 @@ class Hub(GUIObject, common.Hub):
                     # _createBox skipped.  Now that it's become ready, do it.  Note
                     # that we also provide a way to skip this processing (see comments
                     # communication.py) to prevent getting caught in a loop.
-                    if not args[1] and spoke.changed:
+                    if not args[1] and spoke.changed and spoke._visitedSinceApplied:
                         spoke.execute()
+                        spoke._visitedSinceApplied = False
 
                     if self.continuePossible:
                         if self._inSpoke:
@@ -352,7 +360,7 @@ class Hub(GUIObject, common.Hub):
         GUIObject.refresh(self)
         self._createBox()
 
-        self._update_spoke_id = GLib.timeout_add_seconds(1, self._update_spokes)
+        self._update_spoke_id = GLib.timeout_add(100, self._update_spokes)
 
     ### SIGNAL HANDLERS
 
-- 
1.8.1.2



More information about the anaconda-patches mailing list