Re: [PATCH 2/2] Use None to indicate use of default value for clearPartType in UI (#503310, #503681).

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

 



> > I am working on fix, wondering if the shouldClear check is worth being 
> > there.
> > Another case where we probably stumble over it is when doing "Back"s 
> > to the
> > welcome page. Seems like we need to save original ks clearpart choice
> > somewhere for doing UI preselection properly in these cases - it's 
> > getting ugly.
> 
> I fixed PATCH 2/2 (attached) this way:
> - set clearPartType to None before resetting storage when going [Back] 
> from partition editor
> - do not set clearPartType in parttype dialog just to set preselected 
> combobox value which was stupid, clearPartType should be set only after 
> [Next]

This sounds like a definite improvement. For rawhide/master, I think you
should go ahead and commit if you're satisfied with your testing.

Dave

> 
> 
> plain text document attachment
> (0002-Use-None-to-indicate-use-of-default-value-for-clearP.patch)
> >From b5ddbd6e5adb81c50025a7f5dbb7b3f3eefeb48e Mon Sep 17 00:00:00 2001
> From: Radek Vykydal <rvykydal@xxxxxxxxxx>
> Date: Tue, 2 Jun 2009 20:42:36 +0200
> Subject: [PATCH 2/2] Use None to indicate use of default value for clearPartType in UI (#503310, #503681).
> 
> If we are to set clearPartType in "parttype" UI (there is no clearpart in KS), set it really there,
> instead of setting it to CLEARPART_TYPE_NONE just to pass storage device discovery checks
> which are done between ks processing and UI parttype.
> ---
>  installclass.py          |    9 +--------
>  installclasses/fedora.py |    3 +--
>  installclasses/rhel.py   |    3 +--
>  iw/autopart_type.py      |   13 +++++++------
>  iw/partition_gui.py      |    1 +
>  kickstart.py             |    2 +-
>  storage/__init__.py      |    4 ++--
>  storage/partitioning.py  |    2 +-
>  textw/partition_text.py  |    2 ++
>  9 files changed, 17 insertions(+), 22 deletions(-)
> 
> diff --git a/installclass.py b/installclass.py
> index 913444f..d0f535d 100644
> --- a/installclass.py
> +++ b/installclass.py
> @@ -187,8 +187,7 @@ class BaseInstallClass(object):
>          from backend import AnacondaBackend
>          return AnacondaBackend
>  
> -    def setDefaultPartitioning(self, storage, platform,
> -                               clear = CLEARPART_TYPE_LINUX, doClear = True):
> +    def setDefaultPartitioning(self, storage, platform):
>          autorequests = [PartSpec(mountpoint="/", fstype=storage.defaultFSType,
>                                   size=1024, grow=True, asVol=True)]
>  
> @@ -200,12 +199,6 @@ class BaseInstallClass(object):
>          autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap,
>                                       grow=True, asVol=True))
>  
> -        if doClear:
> -            storage.clearPartType = clear
> -            storage.clearPartDisks = []
> -        else:
> -            storage.clearPartType = CLEARPART_TYPE_NONE
> -
>          storage.autoPartitionRequests = autorequests
>  
> 
> diff --git a/installclasses/fedora.py b/installclasses/fedora.py
> index 9c97390..98002ed 100644
> --- a/installclasses/fedora.py
> +++ b/installclasses/fedora.py
> @@ -63,8 +63,7 @@ class InstallClass(BaseInstallClass):
>  	BaseInstallClass.setInstallData(self, anaconda)
>          BaseInstallClass.setDefaultPartitioning(self,
>                                                  anaconda.id.storage,
> -                                                anaconda.platform,
> -                                                CLEARPART_TYPE_NONE)
> +                                                anaconda.platform)
>  
>      def setSteps(self, anaconda):
>  	BaseInstallClass.setSteps(self, anaconda);
> diff --git a/installclasses/rhel.py b/installclasses/rhel.py
> index aa3590d..5c0d715 100644
> --- a/installclasses/rhel.py
> +++ b/installclasses/rhel.py
> @@ -89,8 +89,7 @@ class InstallClass(BaseInstallClass):
>  	BaseInstallClass.setInstallData(self, anaconda)
>          BaseInstallClass.setDefaultPartitioning(self, 
>                                                  anaconda.id.storage,
> -                                                anaconda.platform,
> -                                                CLEARPART_TYPE_NONE)
> +                                                anaconda.platform)
>  
>      def setSteps(self, anaconda):
>          dispatch = anaconda.dispatch
> diff --git a/iw/autopart_type.py b/iw/autopart_type.py
> index bb71401..f192d6a 100644
> --- a/iw/autopart_type.py
> +++ b/iw/autopart_type.py
> @@ -444,15 +444,16 @@ class PartitionTypeWindow(InstallWindow):
>                  (_("Use free space"), CLEARPART_TYPE_NONE),
>                  (_("Create custom layout"), -1))
>  
> -        # Default for UI is Remove linux partitions, so if we
> -        # haven't specified something else in ks, set this default.
> -        # This is not correct if we specify clearpart --none in ks.
> -        if self.storage.clearPartType == CLEARPART_TYPE_NONE:
> -            self.storage.clearPartType = CLEARPART_TYPE_LINUX
> +        # if not set in ks, use UI default
> +        if self.storage.clearPartType is None:
> +            preselected = CLEARPART_TYPE_LINUX
> +        else:
> +            preselected = self.storage.clearPartType 
> +
>          for (txt, val) in opts:
>              iter = store.append(None)
>              store[iter] = (txt, val)
> -            if val == self.storage.clearPartType:
> +            if val == preselected:
>                  self.combo.set_active_iter(iter)
>  
>          if ((self.combo.get_active() == -1) or
> diff --git a/iw/partition_gui.py b/iw/partition_gui.py
> index 9968f07..b97a49b 100644
> --- a/iw/partition_gui.py
> +++ b/iw/partition_gui.py
> @@ -664,6 +664,7 @@ class PartitionWindow(InstallWindow):
>  
>      def getPrev(self):
>          self.diskStripeGraph.shutDown()
> +        self.storage.clearPartType = None
>          self.storage.reset()
>          self.tree.clear()
>          del self.parent
> diff --git a/kickstart.py b/kickstart.py
> index 474ecec..ce63068 100644
> --- a/kickstart.py
> +++ b/kickstart.py
> @@ -147,7 +147,7 @@ class AutoPart(commands.autopart.F9_AutoPart):
>  
>          # sets up default autopartitioning.  use clearpart separately
>          # if you want it
> -        self.handler.id.instClass.setDefaultPartitioning(self.handler.id.storage, self.handler.anaconda.platform, doClear=False)
> +        self.handler.id.instClass.setDefaultPartitioning(self.handler.id.storage, self.handler.anaconda.platform)
>          self.handler.id.storage.doAutoPart = True
>  
>          if self.encrypted:
> diff --git a/storage/__init__.py b/storage/__init__.py
> index 41f09e2..a364bf8 100644
> --- a/storage/__init__.py
> +++ b/storage/__init__.py
> @@ -202,7 +202,7 @@ class Storage(object):
>          self.ignoredDisks = []
>          self.exclusiveDisks = []
>          self.doAutoPart = False
> -        self.clearPartType = CLEARPART_TYPE_NONE
> +        self.clearPartType = None
>          self.clearPartDisks = []
>          self.encryptedAutoPart = False
>          self.encryptionPassphrase = None
> @@ -965,7 +965,7 @@ class Storage(object):
>          f.write("# not guaranteed to work\n")
>  
>          # clearpart
> -        if self.clearPartType == CLEARPART_TYPE_NONE:
> +        if self.clearPartType is None or self.clearPartType == CLEARPART_TYPE_NONE:
>              args = ["--none"]
>          elif self.clearPartType == CLEARPART_TYPE_LINUX:
>              args = ["--linux"]
> diff --git a/storage/partitioning.py b/storage/partitioning.py
> index 8e9ab3c..de3e3e5 100644
> --- a/storage/partitioning.py
> +++ b/storage/partitioning.py
> @@ -306,7 +306,7 @@ def clearPartitions(storage):
>              - Needs some error handling, especially for the parted bits.
>  
>      """
> -    if storage.clearPartType == CLEARPART_TYPE_NONE:
> +    if storage.clearPartType is None or storage.clearPartType == CLEARPART_TYPE_NONE:
>          # not much to do
>          return
>  
> diff --git a/textw/partition_text.py b/textw/partition_text.py
> index 48b7c18..5b97ed2 100644
> --- a/textw/partition_text.py
> +++ b/textw/partition_text.py
> @@ -67,6 +67,8 @@ class PartitionTypeWindow:
>              for (txt, val) in opts:
>                  typebox.append(txt, val)
>  
> +            if anaconda.id.storage.clearPartType is None:
> +                anaconda.id.storage.clearPartType = CLEARPART_TYPE_LINUX
>              typebox.setCurrent(anaconda.id.storage.clearPartType)
>  
>              g.add(typebox, 0, 1, (0, 1, 0, 0))
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
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