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

[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      |    7 +++----
 kickstart.py             |    2 +-
 storage/__init__.py      |    4 ++--
 storage/partitioning.py  |    2 +-
 textw/partition_text.py  |    2 ++
 8 files changed, 12 insertions(+), 20 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..c71ed88 100644
--- a/iw/autopart_type.py
+++ b/iw/autopart_type.py
@@ -444,11 +444,10 @@ 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:
+        # if not set in ks, use UI default
+        if self.storage.clearPartType is None:
             self.storage.clearPartType = CLEARPART_TYPE_LINUX
+
         for (txt, val) in opts:
             iter = store.append(None)
             store[iter] = (txt, val)
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 5ea47e6..bc1678e 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
@@ -931,7 +931,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))
-- 
1.6.0.6


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