[PATCH rhel6-branch 1/2] Add a new bootloader --disabled option.
Chris Lumens
clumens at redhat.com
Mon Aug 4 15:13:13 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.
Related: rhbz#1125410
---
pykickstart/commands/bootloader.py | 13 +++++++++----
tests/commands/bootloader.py | 5 ++++-
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/pykickstart/commands/bootloader.py b/pykickstart/commands/bootloader.py
index e64bbbc..7049d20 100644
--- a/pykickstart/commands/bootloader.py
+++ b/pykickstart/commands/bootloader.py
@@ -1,7 +1,7 @@
#
# Chris Lumens <clumens at redhat.com>
#
-# Copyright 2007 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
@@ -189,12 +189,16 @@ class RHEL6_Bootloader(F12_Bootloader):
F12_Bootloader.__init__(self, writePriority, *args, **kwargs)
self.isCrypted = kwargs.get("isCrypted", False)
+ self.disabled = kwargs.get("disabled", False)
def _getArgsAsStr(self):
- ret = F12_Bootloader._getArgsAsStr(self)
+ if self.disabled:
+ ret = " --disabled"
+ else:
+ ret = F12_Bootloader._getArgsAsStr(self)
- if self.isCrypted:
- ret += " --iscrypted"
+ if self.isCrypted:
+ ret += " --iscrypted"
return ret
@@ -206,6 +210,7 @@ class RHEL6_Bootloader(F12_Bootloader):
op = F12_Bootloader._getParser(self)
op.add_option("--iscrypted", dest="isCrypted", action="store_true", default=False)
op.add_option("--md5pass", action="callback", callback=password_cb, nargs=1, type="string")
+ op.add_option("--disabled", dest="disabled", action="store_true", default=False)
return op
class RHEL5_Bootloader(FC4_Bootloader):
diff --git a/tests/commands/bootloader.py b/tests/commands/bootloader.py
index db6f1d0..4c2ae78 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
@@ -120,5 +120,8 @@ 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")
+ self.assert_parse("bootloader --disabled", "bootloader --disabled\n")
+ self.assert_parse("bootloader --location=mbr --disabled", "bootloader --disabled\n")
+
if __name__ == "__main__":
unittest.main()
--
1.9.3
More information about the anaconda-patches
mailing list