[anaconda] Add autopart --fstype support (#1112697)

Brian C. Lane bcl at redhat.com
Sat Jun 28 00:58:53 UTC 2014


This allows the user to override the default filesystem when using
autopart by specifying autopart --fstype=xfs for example.
---
 pyanaconda/kickstart.py | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index cbb48f0..5048efa 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -249,7 +249,18 @@ class Authconfig(commands.authconfig.FC3_Authconfig):
         except RuntimeError as msg:
             log.error("Error running %s %s: %s", cmd, args, msg)
 
-class AutoPart(commands.autopart.F20_AutoPart):
+class AutoPart(commands.autopart.F21_AutoPart):
+    def parse(self, args):
+        retval = commands.autopart.F21_AutoPart.parse(self, args)
+
+        if self.fstype:
+            fmt = blivet.formats.getFormat(self.fstype)
+            if not fmt or fmt.type is None:
+                raise KickstartValueError(formatErrorMsg(self.lineno,
+                        msg=_("autopart fstype of %s is invalid.") % self.fstype))
+
+        return retval
+
     def execute(self, storage, ksdata, instClass):
         from blivet.partitioning import doAutoPartition
         from blivet.partitioning import sanityCheck
@@ -257,6 +268,13 @@ class AutoPart(commands.autopart.F20_AutoPart):
         if not self.autopart:
             return
 
+        if self.fstype:
+            try:
+                storage.setDefaultFSType(self.fstype)
+            except ValueError:
+                raise KickstartValueError(formatErrorMsg(self.lineno,
+                        msg=_("Settings default fstype to %s failed.") % self.fstype))
+
         # sets up default autopartitioning.  use clearpart separately
         # if you want it
         instClass.setDefaultPartitioning(storage)
-- 
1.9.3



More information about the anaconda-patches mailing list