[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)



> 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
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,
                     self.anaconda.id.rootParts)
   if len(notFound) > 0:
      self.anaconda.id.rootParts = None
      upgrade.findRootParts(self.anaconda)

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.

- Chris


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