[pykickstart - PATCH 2/2] Add a new bootloader --disabled option (#1074522).
Chris Lumens
clumens at redhat.com
Fri Mar 14 19:20:52 UTC 2014
If provided, this takes precedence over all other bootloader options. In
anaconda, it is intended that this option completely skip all bootloader
operations - nothing should be installed to disk, and the bootloader package
should not even be installed.
---
pykickstart/commands/bootloader.py | 23 ++++++++++++++++++++++-
pykickstart/handlers/control.py | 2 +-
tests/commands/bootloader.py | 10 +++++++++-
3 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/pykickstart/commands/bootloader.py b/pykickstart/commands/bootloader.py
index 31978e7..8a2b6dd 100644
--- a/pykickstart/commands/bootloader.py
+++ b/pykickstart/commands/bootloader.py
@@ -1,7 +1,7 @@
#
# Chris Lumens <clumens at redhat.com>
#
-# Copyright 2007-2013 Red Hat, Inc.
+# Copyright 2007-2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
@@ -343,3 +343,24 @@ class F19_Bootloader(F18_Bootloader):
op.add_option("--extlinux", dest="extlinux", action="store_true",
default=False)
return op
+
+class F21_Bootloader(F19_Bootloader):
+ removedKeywords = F19_Bootloader.removedKeywords
+ removedAttrs = F19_Bootloader.removedAttrs
+
+ def __init__(self, writePriority=10, *args, **kwargs):
+ F19_Bootloader.__init__(self, writePriority, *args, **kwargs)
+
+ self.disabled = kwargs.get("disabled", False)
+
+ def _getArgsAsStr(self):
+ if self.disabled:
+ return " --disabled"
+ else:
+ return F19_Bootloader._getArgsAsStr(self)
+
+ def _getParser(self):
+ op = F19_Bootloader._getParser(self)
+ op.add_option("--disabled", dest="disabled", action="store_true",
+ default=False)
+ return op
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index 9257703..442ff58 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -1093,7 +1093,7 @@ commandMap = {
"authconfig": authconfig.FC3_Authconfig,
"autopart": autopart.F20_AutoPart,
"autostep": autostep.FC3_AutoStep,
- "bootloader": bootloader.F19_Bootloader,
+ "bootloader": bootloader.F21_Bootloader,
"btrfs": btrfs.F17_BTRFS,
"cdrom": cdrom.FC3_Cdrom,
"clearpart": clearpart.F17_ClearPart,
diff --git a/tests/commands/bootloader.py b/tests/commands/bootloader.py
index 2f32b88..7c9378e 100644
--- a/tests/commands/bootloader.py
+++ b/tests/commands/bootloader.py
@@ -1,7 +1,7 @@
#
# Chris Lumens <clumens at redhat.com>
#
-# Copyright 2009 Red Hat, Inc.
+# Copyright 2009-2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
@@ -163,6 +163,14 @@ class F19_TestCase(F18_TestCase):
self.assert_parse("bootloader --location=mbr --timeout=5 --extlinux --append=\"rhgb quiet\"",
"bootloader --append=\"rhgb quiet\" --location=mbr --timeout=5 --extlinux\n")
+class F21_TestCase(F19_TestCase):
+ def runTest(self, iscrypted=False):
+ # run parent tests
+ F19_TestCase.runTest(self, iscrypted=iscrypted)
+
+ self.assert_parse("bootloader --disabled", "bootloader --disabled\n")
+ self.assert_parse("bootloader --location=mbr --disabled", "bootloader --disabled\n")
+
if __name__ == "__main__":
unittest.main()
--
1.8.3.1
More information about the anaconda-patches
mailing list