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

Re: [PATCH] Fix upgrade selected in UI after partitioning step (and back) (#503302)

Chris Lumens wrote:
diff --git a/iw/examine_gui.py b/iw/examine_gui.py
index 334f3d1..40a870a 100644
--- a/iw/examine_gui.py
+++ b/iw/examine_gui.py
@@ -84,6 +84,17 @@ class UpgradeExamineWindow (InstallWindow):
     def getScreen (self, anaconda):
         self.anaconda = anaconda
+ # we need to look for root parts again if we came back
+        # to this step after storage reset
+        if self.anaconda.dir == DISPATCH_BACK:
+            for dev, name in self.anaconda.id.rootParts:
+                if dev not in self.anaconda.id.storage.devices:
+                    self.anaconda.dir = DISPATCH_FORWARD
+                    self.anaconda.id.rootParts = None
+ upgrade.findRootParts(self.anaconda) + self.anaconda.dir = DISPATCH_BACK
+                    break
 	if self.anaconda.id.upgrade == None:
 	    # this is the first time we've entered this screen
 	    self.doupgrade = self.anaconda.dispatch.stepInSkipList("installtype")

What's the purpose in calling findRootParts() over and over again in a
It gets called only first time a device from rootParts is not found
in device list, then breaking out of the loop.

It doesn't take in any special arguments that would cause
different behavior.  Seems like if you only want to call it if one of
the devices in rootParts isn't in the device list, you should do
something like:

   notFound = filter(lambda dev, name: dev not in self.anaconda.id.storage.devices,
   if len(notFound) > 0:
      self.anaconda.id.rootParts = None

So it's just a matter of style isn't it?

My taste is to use equivalent list comprehension rather than filter,
but here for loop with break felt more natural to me as
I just wanted to know if there is any obsoleted device in rootParts,
I didn't want to create a list. Just FYI -- your suggestion
probably won't work in Python 3k, because filter is going to return
iterator so len(notFound) wouldn't work I think.

Also, having to mangle the dir variable is kind of gross.  Perhaps we
should break out the logic of findRootParts into its own method without
the direction checking so we can call that from here too.

Yes, I didn't like to mangle it, I will look at this way.


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