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

[PATCH pykickstart] (take II) Port bootloader --hvargs option added in rhel5.



Option was added in bug #501438.
---
 pykickstart/commands/bootloader.py |   23 +++++++++++++++++++++++
 pykickstart/handlers/control.py    |    2 +-
 tests/commands/bootloader.py       |   10 ++++++++++
 3 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/pykickstart/commands/bootloader.py b/pykickstart/commands/bootloader.py
index ce47060..36b9c94 100644
--- a/pykickstart/commands/bootloader.py
+++ b/pykickstart/commands/bootloader.py
@@ -180,3 +180,26 @@ class F12_Bootloader(F8_Bootloader):
         op = F8_Bootloader._getParser(self)
         op.add_option("--lba32", dest="forceLBA", deprecated=1, action="store_true")
         return op
+
+class RHEL5_Bootloader(FC4_Bootloader):
+    removedKeywords = FC4_Bootloader.removedKeywords
+    removedAttrs = FC4_Bootloader.removedAttrs
+
+    def __init__(self, writePriority=10, *args, **kwargs):
+        FC4_Bootloader.__init__(self, writePriority, *args, **kwargs)
+
+        self.hvArgs = kwargs.get("hvArgs", "")
+
+    def _getArgsAsStr(self):
+        ret = FC4_Bootloader._getArgsAsStr(self)
+
+        if self.hvArgs:
+            ret += " --hvargs=\"%s\"" %(self.hvArgs,)
+
+        return ret
+
+    def _getParser(self):
+        op = FC4_Bootloader._getParser(self)
+        op.add_option("--hvargs", dest="hvArgs", type="string")
+        return op
+
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index e6f62c0..70231bb 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -755,7 +755,7 @@ commandMap = {
         "authconfig": authconfig.FC3_Authconfig,
         "autopart": autopart.F9_AutoPart,
         "autostep": autostep.FC3_AutoStep,
-        "bootloader": bootloader.FC4_Bootloader,
+        "bootloader": bootloader.RHEL5_Bootloader,
         "cdrom": method.FC6_Method,
         "clearpart": clearpart.FC3_ClearPart,
         "cmdline": displaymode.FC3_DisplayMode,
diff --git a/tests/commands/bootloader.py b/tests/commands/bootloader.py
index 7eca1ad..662f5c0 100644
--- a/tests/commands/bootloader.py
+++ b/tests/commands/bootloader.py
@@ -100,5 +100,15 @@ class F12_TestCase(F8_TestCase):
         # deprecated
         self.assert_deprecated("bootloader", "--lba32")
 
+class RHEL5_TestCase(FC4_TestCase):
+    def runTest(self):
+        FC4_TestCase.runTest(self)
+
+        self.assert_parse("bootloader --hvargs=bleh",
+                          "bootloader --location=mbr --hvargs=\"bleh\"\n")
+        self.assert_parse("bootloader --hvargs=\"bleh bleh\"",
+                          "bootloader --location=mbr --hvargs=\"bleh bleh\"\n")
+        self.assert_parse_error("bootloader --hvargs", KickstartParseError)
+
 if __name__ == "__main__":
     unittest.main()
-- 
1.6.0.6


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