[rhel6-branch] Keep track of whether users should be prompted to format CDL dasds. (#1164240)

Samantha N. Bueno sbueno+anaconda at redhat.com
Tue Mar 10 15:10:37 UTC 2015


On Mon, Mar 09, 2015 at 08:47:03AM -0400, Anne Mulhern wrote:
> 
> Could easily make that whole chunk of code shorter instead of longer,
> in order to solve problem, something like:
> 
> if not intf and not zeroMbr and not cdl:
>     log.info(...)
>     sys.exit(0)
> 
> # now onto formatting...
> if not len(self._dasdlist):
>     log.info...
> else:
>     self.format_dasds(intf, not zeroMbr, self._dasdlist)
> 
> if not...
>     log.info...
> else:
>     self.format_dasds(intf, not cdl, self._ldldasdlist)

Yeah that's true, so:

diff --git a/storage/dasd.py b/storage/dasd.py
index 17f81bd..b73badf 100644
--- a/storage/dasd.py
+++ b/storage/dasd.py
@@ -105,12 +105,9 @@ class DASD:
                                                                          bypath))
                 self._ldldasdlist.append((device, bypath))
 
-        askUser = True
-
-        if zeroMbr or cdl:
-            askUser = False
-        elif not intf and not zeroMbr:
+        if not intf and (not zeroMbr or not cdl):
             log.info("    non-interactive kickstart install without zerombr "
+                     "or clearpart --cdl "
                      "command, unable to run dasdfmt, exiting installer")
             sys.exit(0)
 
@@ -118,12 +115,12 @@ class DASD:
         if not len(self._dasdlist):
             log.info("    no unformatted DASD devices found")
         else:
-            self.format_dasds(intf, askUser, self._dasdlist)
+            self.format_dasds(intf, not zeroMbr, self._dasdlist)
 
         if not len(self._ldldasdlist):
             log.info("    no LDL DASD devices found")
         else:
-            self.format_dasds(intf, askUser, self._ldldasdlist)
+            self.format_dasds(intf, not cdl, self._ldldasdlist)
 
     def format_dasds(self, intf, askUser, dasdlist):
         """ Iterate through a given list of DASDs and run dasdfmt on them. """


More information about the anaconda-patches mailing list