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

can someone help me with adding a kickstart flag?



Soooo, I'm trying to add "--extlinux" ¹ as an option to the bootloader
command. I have the following patches to pykickstart and to anaconda, on
top of the previously-posted to anaconda-patches ones. I know that the
previous patches which add extlinux as a commandline option work. And, I
know that this is _partitially_ working, because if I don't have the patched
pykickstart in my installer image it errors out with --extlinux being
invalid. With this code, it silently accepts bootloader --extlinux, but then
doesn't actually switch from grub.

I'm probaby doing something really silly, or missing something obvious. I'd
appreciate if someone could help me figure out where!



diff --git a/pykickstart/commands/bootloader.py b/pykickstart/commands/bootloader.py
index 0eb2a1b..32035cf 100644
--- a/pykickstart/commands/bootloader.py
+++ b/pykickstart/commands/bootloader.py
@@ -307,3 +307,26 @@ class RHEL6_Bootloader(F12_Bootloader):
         op.add_option("--iscrypted", dest="isCrypted", action="store_true", default=False)
         op.add_option("--md5pass", action="callback", callback=password_cb, nargs=1, type="string")
         return op
+
+class F19_Bootloader(F18_Bootloader):
+    removedKeywords = F18_Bootloader.removedKeywords
+    removedAttrs = F18_Bootloader.removedAttrs
+
+    def __init__(self, writePriority=10, *args, **kwargs):
+        F18_Bootloader.__init__(self, writePriority, *args, **kwargs)
+
+        self.extlinux = kwargs.get("extlinux", False)
+
+    def _getArgsAsStr(self):
+        ret = F18_Bootloader._getArgsAsStr(self)
+
+        if self.extlinux:
+            ret += " --extlinux"
+
+        return ret
+
+    def _getParser(self):
+        op = F18_Bootloader._getParser(self)
+        op.add_option("--extlinux", dest="extlinux", action="store_true",
+                      default=False)
+        return op
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index 1993478..e77e7e4 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -950,7 +950,7 @@ commandMap = {
         "authconfig": authconfig.FC3_Authconfig,
         "autopart": autopart.F18_AutoPart,
         "autostep": autostep.FC3_AutoStep,
-        "bootloader": bootloader.F18_Bootloader,
+        "bootloader": bootloader.F19_Bootloader,
         "btrfs": btrfs.F17_BTRFS,
         "cdrom": method.F18_Method,
         "clearpart": clearpart.F17_ClearPart,
diff --git a/tests/commands/bootloader.py b/tests/commands/bootloader.py
index 8e916a6..0ffa10c 100644
--- a/tests/commands/bootloader.py
+++ b/tests/commands/bootloader.py
@@ -148,5 +148,14 @@ class RHEL6_TestCase(F12_TestCase):
         self.assert_parse("bootloader --password=blahblah --iscrypted", "bootloader --location=mbr --password=\"blahblah\" --iscrypted\n")
         self.assert_parse("bootloader --md5pass=blahblah", "bootloader --location=mbr --password=\"blahblah\" --iscrypted\n")
 
+class F19_TestCase(F18_TestCase):
+    def runTest(self, iscrypted=False):
+        # run parent tests
+        F18_TestCase.runTest(self, iscrypted=iscrypted)
+
+        self.assert_parse("bootloader --location=mbr --timeout=5 --append=\"rhgb quiet\"")
+        self.assert_parse("bootloader --location=mbr --timeout=5 --extlinux --append=\"rhgb quiet\"")
+
+
 if __name__ == "__main__":
     unittest.main()




diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index cd6713d..0bad770 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -241,7 +241,7 @@ class AutoPart(commands.autopart.F18_AutoPart):
 
         doAutoPartition(storage, ksdata)
 
-class Bootloader(commands.bootloader.F18_Bootloader):
+class Bootloader(commands.bootloader.F19_Bootloader):
     def execute(self, storage, ksdata, instClass):
         if self.location == "none":
             location = None
@@ -294,6 +294,9 @@ class Bootloader(commands.bootloader.F18_Bootloader):
         if self.leavebootorder:
             flags.leavebootorder = True
 
+        if self.extlinux:
+            flags.extlinux = True
+
 class BTRFS(commands.btrfs.F17_BTRFS):
     def execute(self, storage, ksdata, instClass):
         for b in self.btrfsList:




1. I have no really strong objection to --useExtlinux, like the old
   --useLilo, but that has always seemed kind of awkward to me, and the
   other flags aren't consistently verbs. But I'm okay either way if someone
   does care.


-- 
Matthew Miller  ☁☁☁  Fedora Cloud Architect  ☁☁☁  <mattdm fedoraproject org>


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