[RHEL 6] Configure new-kernel-pkg to keep tboot configuration on updates (#742885)
by Peter Jones
If we want tboot to keep getting used, we need to configure
new-kernel-pkg to tell grubby to do that. When grubby finds a multiboot
stanza as the default template, it won't use the multiboot parts of the
template unless specifically configured to. This patch adds a
configuration option to tell grubby that we always want to use the tboot
multiboot kernel by default when we add a new kernel.
Signed-off-by: Peter Jones <pjones(a)redhat.com>
---
bootloader.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/bootloader.py b/bootloader.py
index c77830a..6c0d801 100644
--- a/bootloader.py
+++ b/bootloader.py
@@ -226,6 +226,10 @@ def writeBootloader(anaconda):
f.write("\n")
f.write("# DEFAULTKERNEL specifies the default kernel package type\n")
f.write("DEFAULTKERNEL=%s\n" %(defkern,))
+ if anaconda.id.bootloader.trusted_boot:
+ f.write("# HYPERVISOR specifies the default multiboot kernel\n");
+ f.write("HYPERVISOR=/boot/tboot.gz\n");
+ f.write("HYPERVISOR_ARGS=logging=vga,serial,memory\n");
f.close()
dosync()
--
1.7.12.1
11 years, 7 months
[PATCH] Avoid using mount --move on shared paths (#853508)
by Jesse Keating
move doesn't work because /run/ is a shared filesystem. So do as
systemd suggests, mark the filesystem as private. We don't know of any
reason in anaconda for the filesystem to be shared anyway.
This hack can go away if/when the kernel ever allows moving mounts
within a shared filesystem.
---
dracut/anaconda-lib.sh | 3 ++-
pyanaconda/packaging/yumpayload.py | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh
index 6b9a707..af6690d 100755
--- a/dracut/anaconda-lib.sh
+++ b/dracut/anaconda-lib.sh
@@ -54,7 +54,7 @@ anaconda_live_root_dir() {
img=$(find_runtime $mnt/$path)
if [ -n "$img" ]; then
info "anaconda: found $img"
- [ "$mnt" = "$repodir" ] || mount --move $mnt $repodir
+ [ "$mnt" = "$repodir" ] || { mount --rprivate /; mount --move $mnt $isodir; }
anaconda_auto_updates $repodir/$path/images
else
if [ "${path%.iso}" != "$path" ]; then
@@ -65,6 +65,7 @@ anaconda_live_root_dir() {
fi
[ -n "$iso" ] || { warn "no suitable images"; return 1; }
info "anaconda: found $iso"
+ mount --rprivate /
mount --move $mnt $isodir
iso=${isodir}/${iso#$mnt}
mount -o loop,ro $iso $repodir
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index cd2e22e..49c586e 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -563,6 +563,10 @@ reposdir=%s
# install from one of them
if image:
# move the mount to ISO_DIR
+ # work around inability to move shared filesystems
+ iutil.execWithRedirect("mount",
+ ["--rprivate", "/"],
+ stderr="/dev/tty5", stdout="/dev/tty5")
iutil.execWithRedirect("mount",
["--move", INSTALL_TREE, ISO_DIR],
stderr="/dev/tty5", stdout="/dev/tty5")
--
1.7.11.4
11 years, 7 months
[PATCH] Initialize disks with no partitions (#864360)
by Brian C. Lane
From: "Brian C. Lane" <bcl(a)redhat.com>
Treat a disk with a disklabel but no partitions the same as an
uninitialized disk.
---
pyanaconda/storage/__init__.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index 8df216e..4316e1b 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -694,6 +694,10 @@ class Storage(object):
return None
def shouldClear(self, device, **kwargs):
+ def empty_disk():
+ return bool(device.format.type is None or \
+ len(self.devicetree.getChildren(device)) == 0)
+
clearPartType = kwargs.get("clearPartType", self.config.clearPartType)
clearPartDisks = kwargs.get("clearPartDisks",
self.config.clearPartDisks)
@@ -720,11 +724,11 @@ class Storage(object):
return False
# the only devices we want to clear when clearPartType is
- # CLEARPART_TYPE_NONE are uninitialized disks in clearPartDisks, and
- # then only when we have been asked to initialize disks as needed
+ # CLEARPART_TYPE_NONE are uninitialized disks in clearPartDisks,
+ # disks with no partitions and then only when we have been asked
+ # to initialize disks as needed
if clearPartType in [CLEARPART_TYPE_NONE, None] and \
- not (device.isDisk and device.format.type is None and
- self.config.initializeDisks):
+ not (device.isDisk and empty_disk() and self.config.initializeDisks):
return False
if isinstance(device, PartitionDevice):
--
1.7.11.4
11 years, 7 months
[master] [PATCH] Release Gdk lock in exception handling
by Vratislav Podzimek
Since we add actions to main loop, not releasing lock may lead
to deadlock.
<not-in-commit-msg>
Until we have Martin's patches reworking threading, this is needed to
handle exceptions from 'with gdk_threaded:' blocks.
</not-in-commit-msg>
---
pyanaconda/exception.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
index 871c056..4e369d8 100644
--- a/pyanaconda/exception.py
+++ b/pyanaconda/exception.py
@@ -69,7 +69,11 @@ class AnacondaExceptionHandler(ExceptionHandler):
sys.exit(0)
else:
try:
- from gi.repository import Gtk
+ from gi.repository import Gtk, Gdk
+
+ # Release Gdk lock to prevent deadlocks in cases when
+ # exception appeared in gdk_threaded block
+ Gdk.threads_leave()
if Gtk.main_level() > 0:
# main loop is running, don't crash it by running another one
--
1.7.11.4
11 years, 7 months
[PATCH master] Network spoke: make Configure button insensitive when running nmce (#865931)
by Radek Vykydal
---
pyanaconda/ui/gui/spokes/network.py | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index a3fbf87..c2fcf8b 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -428,7 +428,13 @@ class NetworkControlBox():
else:
return
- subprocess.Popen(["nm-connection-editor", "--edit", "%s" % uuid])
+ self.builder.get_object("button_wired_options").set_sensitive(False)
+ proc = subprocess.Popen(["nm-connection-editor", "--edit", "%s" % uuid])
+
+ GLib.child_watch_add(proc.pid, self.on_nmce_exited)
+
+ def on_nmce_exited(self, pid, condition):
+ self.builder.get_object("button_wired_options").set_sensitive(True)
def on_wireless_enabled(self, *args):
switch = self.builder.get_object("device_wireless_off_switch")
--
1.7.4
11 years, 7 months
[PATCH] Fix a traceback in media check (#865897).
by Chris Lumens
---
pyanaconda/ui/gui/spokes/source.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index 4d43889..9d336cc 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -818,12 +818,11 @@ class SourceSpoke(NormalSpoke):
dialog = MediaCheckDialog(self.data)
with enlightbox(self.window, dialog.window):
- dev = self.storage.devicetree.getDeviceByName(dev)
- unmount = not dev.format.status
- dev.format.mount(mountpoint=MOUNTPOINT)
+ unmount = not p.format.status
+ p.format.mount(mountpoint=MOUNTPOINT)
dialog.run(MOUNTPOINT + "/" + f)
if unmount:
- dev.format.unmount()
+ p.format.unmount()
def on_verify_media_clicked(self, button):
dev = self._get_selected_media()
--
1.7.11.2
11 years, 7 months
[pykickstart][PATCH] Add cipher option for encrypting block devices.
by David Lehman
(based on commit 4946bcf5d330338a160c12e77f3252fce60994d4
from rhel6-branch)
Also update some RHEL6 stuff that didn't make it to master.
---
pykickstart/commands/autopart.py | 50 ++++++++++++++++++++++++++++++++++++-
pykickstart/commands/logvol.py | 37 ++++++++++++++++++++++++++++
pykickstart/commands/partition.py | 36 +++++++++++++++++++++++++++
pykickstart/commands/raid.py | 52 +++++++++++++++++++++++++++++++++++++++
pykickstart/handlers/control.py | 22 ++++++++---------
tests/commands/autopart.py | 27 ++++++++++++++++++++
tests/commands/logvol.py | 27 ++++++++++++++++++++
tests/commands/partition.py | 25 +++++++++++++++++++
tests/commands/raid.py | 26 ++++++++++++++++++++
9 files changed, 290 insertions(+), 12 deletions(-)
diff --git a/pykickstart/commands/autopart.py b/pykickstart/commands/autopart.py
index 910886f..a00efdb 100644
--- a/pykickstart/commands/autopart.py
+++ b/pykickstart/commands/autopart.py
@@ -1,7 +1,7 @@
#
# Chris Lumens <clumens(a)redhat.com>
#
-# Copyright 2005, 2006, 2007, 2008 Red Hat, Inc.
+# Copyright 2005, 2006, 2007, 2008, 2012 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,6 +120,30 @@ class F12_AutoPart(F9_AutoPart):
op.add_option("--backuppassphrase", action="store_true", default=False)
return op
+class RHEL6_AutoPart(F12_AutoPart):
+ removedKeywords = F12_AutoPart.removedKeywords
+ removedAttrs = F12_AutoPart.removedAttrs
+
+ def __init__(self, writePriority=100, *args, **kwargs):
+ F12_AutoPart.__init__(self, writePriority=writePriority, *args, **kwargs)
+ self.cipher = kwargs.get("cipher", "")
+
+ def __str__(self):
+ retval = F12_AutoPart.__str__(self)
+
+ if self.encrypted and self.cipher:
+ # remove any trailing newline
+ retval = retval.strip()
+ retval += " --cipher=\"%s\"" % self.cipher
+ retval += "\n"
+
+ return retval
+
+ def _getParser(self):
+ op = F12_AutoPart._getParser(self)
+ op.add_option("--cipher")
+ return op
+
class F16_AutoPart(F12_AutoPart):
removedKeywords = F12_AutoPart.removedKeywords
removedAttrs = F12_AutoPart.removedAttrs
@@ -199,3 +223,27 @@ class F17_AutoPart(F16_AutoPart):
self.lvm = True
return self
+
+class F18_AutoPart(F17_AutoPart):
+ removedKeywords = F17_AutoPart.removedKeywords
+ removedAttrs = F17_AutoPart.removedAttrs
+
+ def __init__(self, writePriority=100, *args, **kwargs):
+ F17_AutoPart.__init__(self, writePriority=writePriority, *args, **kwargs)
+ self.cipher = kwargs.get("cipher", "")
+
+ def __str__(self):
+ retval = F17_AutoPart.__str__(self)
+
+ if self.encrypted and self.cipher:
+ # remove any trailing newline
+ retval = retval.strip()
+ retval += " --cipher=\"%s\"" % self.cipher
+ retval += "\n"
+
+ return retval
+
+ def _getParser(self):
+ op = F17_AutoPart._getParser(self)
+ op.add_option("--cipher")
+ return op
diff --git a/pykickstart/commands/logvol.py b/pykickstart/commands/logvol.py
index 1e6579e..5fcb6e5 100644
--- a/pykickstart/commands/logvol.py
+++ b/pykickstart/commands/logvol.py
@@ -166,6 +166,26 @@ class F12_LogVolData(F9_LogVolData):
return retval
+class RHEL6_LogVolData(F12_LogVolData):
+ removedKeywords = F12_LogVolData.removedKeywords
+ removedAttrs = F12_LogVolData.removedAttrs
+
+ def __init__(self, *args, **kwargs):
+ F12_LogVolData.__init__(self, *args, **kwargs)
+
+ self.cipher = kwargs.get("cipher", "")
+ self.hibernation = kwargs.get("hibernation", False)
+
+ def _getArgsAsStr(self):
+ retval = F12_LogVolData._getArgsAsStr(self)
+
+ if self.encrypted and self.cipher:
+ retval += " --cipher=\"%s\"" % self.cipher
+ if self.hibernation:
+ retval += " --hibernation"
+
+ return retval
+
F14_LogVolData = F12_LogVolData
class F15_LogVolData(F14_LogVolData):
@@ -200,6 +220,7 @@ class F18_LogVolData(F17_LogVolData):
def __init__(self, *args, **kwargs):
F17_LogVolData.__init__(self, *args, **kwargs)
self.hibernation = kwargs.get("hibernation", False)
+ self.cipher = kwargs.get("cipher", "")
def _getArgsAsStr(self):
retval = F17_LogVolData._getArgsAsStr(self)
@@ -207,6 +228,9 @@ class F18_LogVolData(F17_LogVolData):
if self.hibernation:
retval += " --hibernation"
+ if self.encrypted and self.cipher:
+ retval += " --cipher=\"%s\"" % self.cipher
+
return retval
class FC3_LogVol(KickstartCommand):
@@ -316,6 +340,18 @@ class F12_LogVol(F9_LogVol):
op.add_option("--backuppassphrase", action="store_true", default=False)
return op
+class RHEL6_LogVol(F12_LogVol):
+ removedKeywords = F12_LogVol.removedKeywords
+ removedAttrs = F12_LogVol.removedAttrs
+
+ def _getParser(self):
+ op = F12_LogVol._getParser(self)
+ op.add_option("--cipher")
+ op.add_option("--hibernation", dest="hibernation", action="store_true",
+ default=False)
+
+ return op
+
class F14_LogVol(F12_LogVol):
removedKeywords = F12_LogVol.removedKeywords
removedAttrs = F12_LogVol.removedAttrs
@@ -355,5 +391,6 @@ class F18_LogVol(F17_LogVol):
def _getParser(self):
op = F17_LogVol._getParser(self)
op.add_option("--hibernation", action="store_true", default=False)
+ op.add_option("--cipher")
return op
diff --git a/pykickstart/commands/partition.py b/pykickstart/commands/partition.py
index e30f849..62aa8f4 100644
--- a/pykickstart/commands/partition.py
+++ b/pykickstart/commands/partition.py
@@ -186,6 +186,26 @@ class F12_PartData(F11_PartData):
return retval
+class RHEL6_PartData(F12_PartData):
+ removedKeywords = F12_PartData.removedKeywords
+ removedAttrs = F12_PartData.removedAttrs
+
+ def __init__(self, *args, **kwargs):
+ F12_PartData.__init__(self, *args, **kwargs)
+
+ self.cipher = kwargs.get("cipher", "")
+ self.hibernation = kwargs.get("hibernation", False)
+
+ def _getArgsAsStr(self):
+ retval = F12_PartData._getArgsAsStr(self)
+
+ if self.encrypted and self.cipher:
+ retval += " --cipher=\"%s\"" % self.cipher
+ if self.hibernation:
+ retval += " --hibernation"
+
+ return retval
+
F14_PartData = F12_PartData
class F17_PartData(F14_PartData):
@@ -207,6 +227,7 @@ class F18_PartData(F17_PartData):
F17_PartData.__init__(self, *args, **kwargs)
self.hibernation = kwargs.get("hibernation", False)
+ self.cipher = kwargs.get("cipher", "")
def _getArgsAsStr(self):
retval = F17_PartData._getArgsAsStr(self)
@@ -214,6 +235,9 @@ class F18_PartData(F17_PartData):
if self.hibernation:
retval += " --hibernation"
+ if self.encrypted and self.cipher:
+ retval += " --cipher=\"%s\"" % self.cipher
+
return retval
class FC3_Partition(KickstartCommand):
@@ -370,6 +394,17 @@ class F12_Partition(F11_Partition):
op.add_option("--backuppassphrase", action="store_true", default=False)
return op
+class RHEL6_Partition(F12_Partition):
+ removedKeywords = F12_Partition.removedKeywords
+ removedAttrs = F12_Partition.removedAttrs
+
+ def _getParser(self):
+ op = F12_Partition._getParser(self)
+ op.add_option("--cipher")
+ op.add_option("--hibernation", dest="hibernation", action="store_true",
+ default=False)
+ return op
+
class F14_Partition(F12_Partition):
removedKeywords = F12_Partition.removedKeywords
removedAttrs = F12_Partition.removedAttrs
@@ -402,5 +437,6 @@ class F18_Partition(F17_Partition):
def _getParser(self):
op = F17_Partition._getParser(self)
op.add_option("--hibernation", dest="hibernation", action="store_true", default=False)
+ op.add_option("--cipher")
return op
diff --git a/pykickstart/commands/raid.py b/pykickstart/commands/raid.py
index 4ba353d..d99f992 100644
--- a/pykickstart/commands/raid.py
+++ b/pykickstart/commands/raid.py
@@ -175,6 +175,23 @@ class F12_RaidData(F9_RaidData):
F13_RaidData = F12_RaidData
+class RHEL6_RaidData(F13_RaidData):
+ removedKeywords = F13_RaidData.removedKeywords
+ removedAttrs = F13_RaidData.removedAttrs
+
+ def __init__(self, *args, **kwargs):
+ F13_RaidData.__init__(self, *args, **kwargs)
+
+ self.cipher = kwargs.get("cipher", "")
+
+ def _getArgsAsStr(self):
+ retval = F13_RaidData._getArgsAsStr(self)
+
+ if self.encrypted and self.cipher:
+ retval += " --cipher=\"%s\"" % self.cipher
+
+ return retval
+
F14_RaidData = F13_RaidData
class F15_RaidData(F14_RaidData):
@@ -195,6 +212,23 @@ class F15_RaidData(F14_RaidData):
return retval
+class F18_RaidData(F15_RaidData):
+ removedKeywords = F15_RaidData.removedKeywords
+ removedAttrs = F15_RaidData.removedAttrs
+
+ def __init__(self, *args, **kwargs):
+ F15_RaidData.__init__(self, *args, **kwargs)
+
+ self.cipher = kwargs.get("cipher", "")
+
+ def _getArgsAsStr(self):
+ retval = F15_RaidData._getArgsAsStr(self)
+
+ if self.encrypted and self.cipher:
+ retval += " --cipher=\"%s\"" % self.cipher
+
+ return retval
+
class FC3_Raid(KickstartCommand):
removedKeywords = KickstartCommand.removedKeywords
removedAttrs = KickstartCommand.removedAttrs
@@ -360,6 +394,15 @@ class F13_Raid(F12_Raid):
self.levelMap.update({"RAID4": "RAID4", "4": "RAID4"})
+class RHEL6_Raid(F13_Raid):
+ removedKeywords = F13_Raid.removedKeywords
+ removedAttrs = F13_Raid.removedAttrs
+
+ def _getParser(self):
+ op = F13_Raid._getParser(self)
+ op.add_option("--cipher")
+ return op
+
class F14_Raid(F13_Raid):
removedKeywords = F13_Raid.removedKeywords
removedAttrs = F13_Raid.removedAttrs
@@ -377,3 +420,12 @@ class F15_Raid(F14_Raid):
op = F14_Raid._getParser(self)
op.add_option("--label")
return op
+
+class F18_Raid(F15_Raid):
+ removedKeywords = F15_Raid.removedKeywords
+ removedAttrs = F15_Raid.removedAttrs
+
+ def _getParser(self):
+ op = F15_Raid._getParser(self)
+ op.add_option("--cipher")
+ return op
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index 0e02355..fb1424d 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -888,7 +888,7 @@ commandMap = {
F18: {
"auth": authconfig.FC3_Authconfig,
"authconfig": authconfig.FC3_Authconfig,
- "autopart": autopart.F17_AutoPart,
+ "autopart": autopart.F18_AutoPart,
"autostep": autostep.FC3_AutoStep,
"bootloader": bootloader.F18_Bootloader,
"btrfs": btrfs.F17_BTRFS,
@@ -921,7 +921,7 @@ commandMap = {
"part": partition.F18_Partition,
"partition": partition.F18_Partition,
"poweroff": reboot.F18_Reboot,
- "raid": raid.F15_Raid,
+ "raid": raid.F18_Raid,
"reboot": reboot.F18_Reboot,
"repo": repo.F15_Repo,
"rescue": rescue.F10_Rescue,
@@ -1107,7 +1107,7 @@ commandMap = {
RHEL6: {
"auth": authconfig.FC3_Authconfig,
"authconfig": authconfig.FC3_Authconfig,
- "autopart": autopart.F12_AutoPart,
+ "autopart": autopart.RHEL6_AutoPart,
"autostep": autostep.FC3_AutoStep,
"bootloader": bootloader.RHEL6_Bootloader,
"cdrom": method.RHEL6_Method,
@@ -1132,16 +1132,16 @@ commandMap = {
"keyboard": keyboard.FC3_Keyboard,
"lang": lang.FC3_Lang,
"logging": logging.FC6_Logging,
- "logvol": logvol.F12_LogVol,
+ "logvol": logvol.RHEL6_LogVol,
"mediacheck": mediacheck.FC4_MediaCheck,
"monitor": monitor.F10_Monitor,
"multipath": multipath.FC6_MultiPath,
"network": network.RHEL6_Network,
"nfs": method.RHEL6_Method,
- "part": partition.F12_Partition,
- "partition": partition.F12_Partition,
+ "part": partition.RHEL6_Partition,
+ "partition": partition.RHEL6_Partition,
"poweroff": reboot.FC6_Reboot,
- "raid": raid.F13_Raid,
+ "raid": raid.RHEL6_Raid,
"reboot": reboot.FC6_Reboot,
"repo": repo.RHEL6_Repo,
"rescue": rescue.F10_Rescue,
@@ -1467,7 +1467,7 @@ dataMap = {
"MultiPathData": multipath.FC6_MultiPathData,
"NetworkData": network.F16_NetworkData,
"PartData": partition.F18_PartData,
- "RaidData": raid.F15_RaidData,
+ "RaidData": raid.F18_RaidData,
"RepoData": repo.F15_RepoData,
"SshPwData": sshpw.F13_SshPwData,
"UserData": user.F12_UserData,
@@ -1513,11 +1513,11 @@ dataMap = {
"FcoeData": fcoe.F13_FcoeData,
"GroupData": group.F12_GroupData,
"IscsiData": iscsi.RHEL6_IscsiData,
- "LogVolData": logvol.F12_LogVolData,
+ "LogVolData": logvol.RHEL6_LogVolData,
"MultiPathData": multipath.FC6_MultiPathData,
"NetworkData": network.RHEL6_NetworkData,
- "PartData": partition.F12_PartData,
- "RaidData": raid.F13_RaidData,
+ "PartData": partition.RHEL6_PartData,
+ "RaidData": raid.RHEL6_RaidData,
"RepoData": repo.RHEL6_RepoData,
"SshPwData": sshpw.F13_SshPwData,
"UserData": user.F12_UserData,
diff --git a/tests/commands/autopart.py b/tests/commands/autopart.py
index a2b288a..f05124a 100644
--- a/tests/commands/autopart.py
+++ b/tests/commands/autopart.py
@@ -79,6 +79,19 @@ class F12_TestCase(F9_TestCase):
self.assert_parse_error("autopart --backuppassphrase=False")
self.assert_parse_error("autopart --backuppassphrase=True")
+class RHEL6_TestCase(F12_TestCase):
+ def runTest(self):
+ F12_TestCase.runTest(self)
+
+ # pass
+ self.assert_parse("autopart --cipher=foo", "autopart\n")
+ self.assert_parse("autopart --encrypted --cipher=3-rot13",
+ "autopart --encrypted --cipher=\"3-rot13\"\n")
+
+ # fail
+ self.assert_parse_error("autopart --cipher")
+ self.assert_parse_error("autopart --encrypted --cipher")
+
class F16_TestCase(F12_TestCase):
def runTest(self):
# Run F12 test case
@@ -118,5 +131,19 @@ class F17_TestCase(F16_TestCase):
# fail
self.assert_parse_error("autopart --type")
+class F18_TestCase(F17_TestCase):
+ def runTest(self):
+ F17_TestCase.runTest(self)
+
+ # pass
+ self.assert_parse("autopart --cipher=foo", "autopart\n")
+ self.assert_parse("autopart --encrypted --cipher=3-rot13",
+ "autopart --encrypted --cipher=\"3-rot13\"\n")
+
+ # fail
+ self.assert_parse_error("autopart --cipher")
+ self.assert_parse_error("autopart --encrypted --cipher")
+
+
if __name__ == "__main__":
unittest.main()
diff --git a/tests/commands/logvol.py b/tests/commands/logvol.py
index e255faf..cd868fd 100644
--- a/tests/commands/logvol.py
+++ b/tests/commands/logvol.py
@@ -181,6 +181,24 @@ class F12_TestCase(F9_TestCase):
self.assert_parse_error("logvol / --backuppassphrase=True --name=NAME "
"--vgname=VGNAME")
+class RHEL6_TestCase(F12_TestCase):
+ def runTest(self):
+ F12_TestCase.runTest(self)
+
+ self.assert_parse("logvol / --encrypted --cipher=3-rot13 --name=NAME --vgname=VGNAME",
+ "logvol / --encrypted --cipher=\"3-rot13\" --name=NAME --vgname=VGNAME\n")
+ # Allowed here, but anaconda should complain. Note how we throw out
+ # cipher from the output if there's no --encrypted.
+ self.assert_parse("logvol / --cipher=3-rot13 --name=NAME --vgname=VGNAME",
+ "logvol / --name=NAME --vgname=VGNAME\n")
+
+ self.assert_parse_error("logvol / --cipher --name=NAME --vgname=VGNAME")
+
+ self.assert_parse("logvol swap --hibernation "
+ "--name=NAME --vgname=VGNAME")
+ self.assert_parse("logvol swap --recommended --hibernation "
+ "--name=NAME --vgname=VGNAME")
+
class F14_TestCase(F12_TestCase):
def runTest(self):
F12_TestCase.runTest(self)
@@ -216,5 +234,14 @@ class F18_TestCase(F17_TestCase):
self.assert_parse("logvol swap --name=NAME --vgname=VGNAME "\
"--recommended --hibernation")
+ self.assert_parse("logvol / --encrypted --cipher=3-rot13 --name=NAME --vgname=VGNAME",
+ "logvol / --encrypted --cipher=\"3-rot13\" --name=NAME --vgname=VGNAME\n")
+ # Allowed here, but anaconda should complain. Note how we throw out
+ # cipher from the output if there's no --encrypted.
+ self.assert_parse("logvol / --cipher=3-rot13 --name=NAME --vgname=VGNAME",
+ "logvol / --name=NAME --vgname=VGNAME\n")
+
+ self.assert_parse_error("logvol / --cipher --name=NAME --vgname=VGNAME")
+
if __name__ == "__main__":
unittest.main()
diff --git a/tests/commands/partition.py b/tests/commands/partition.py
index 6df1510..6c81b9e 100644
--- a/tests/commands/partition.py
+++ b/tests/commands/partition.py
@@ -152,6 +152,22 @@ class F12_TestCase(F9_TestCase):
self.assert_parse_error("part / --backuppassphrase=False")
self.assert_parse_error("part / --backuppassphrase=True")
+class RHEL6_TestCase(F12_TestCase):
+ def runTest(self):
+ F12_TestCase.runTest(self)
+
+ self.assert_parse("part / --encrypted --cipher=3-rot13",
+ "part / --encrypted --cipher=\"3-rot13\"\n")
+ # Allowed here, but anaconda should complain. Note how we throw out
+ # cipher from the output if there's no --encrypted.
+ self.assert_parse("part / --cipher=3-rot13",
+ "part /\n")
+
+ self.assert_parse_error("part / --cipher")
+
+ self.assert_parse("part swap --hibernation")
+ self.assert_parse("part swap --recommended --hibernation")
+
class F14_TestCase(F12_TestCase):
def runTest(self):
F12_TestCase.runTest(self)
@@ -181,5 +197,14 @@ class F18_TestCase(F17_TestCase):
self.assert_parse("part swap --recommended")
self.assert_parse("part swap --recommended --hibernation")
+ self.assert_parse("part / --encrypted --cipher=3-rot13",
+ "part / --encrypted --cipher=\"3-rot13\"\n")
+ # Allowed here, but anaconda should complain. Note how we throw out
+ # cipher from the output if there's no --encrypted.
+ self.assert_parse("part / --cipher=3-rot13",
+ "part /\n")
+
+ self.assert_parse_error("part / --cipher")
+
if __name__ == "__main__":
unittest.main()
diff --git a/tests/commands/raid.py b/tests/commands/raid.py
index 7b6675a..bc63632 100644
--- a/tests/commands/raid.py
+++ b/tests/commands/raid.py
@@ -179,6 +179,19 @@ class F13_TestCase(F12_TestCase):
F12_TestCase.__init__(self, *kargs, **kwargs)
self.validLevels.append("RAID4")
+class RHEL6_TestCase(F13_TestCase):
+ def runTest(self):
+ F13_TestCase.runTest(self)
+
+ self.assert_parse("raid / --device=md0 --level=1 --encrypted --cipher=3-rot13 raid.01 raid.02",
+ "raid / --device=0 --level=RAID1 --encrypted --cipher=\"3-rot13\" raid.01 raid.02\n")
+ # Allowed here, but anaconda should complain. Note how we throw out
+ # cipher from the output if there's no --encrypted.
+ self.assert_parse("raid / --device=md0 --level=1 --cipher=3-rot13 raid.01 raid.02",
+ "raid / --device=0 --level=RAID1 raid.01 raid.02\n")
+
+ self.assert_parse_error("raid / --cipher --device=md0 --level=1 raid.01 raid.02")
+
class F14_TestCase(F13_TestCase):
def runTest(self):
F13_TestCase.runTest(self)
@@ -192,5 +205,18 @@ class F15_TestCase(F14_TestCase):
self.assert_parse("raid / --device=md0 --label=ROOT --level=1 raid.01 raid.02",
"raid / --device=0 --level=RAID1 --label=ROOT raid.01 raid.02\n")
+class F18_TestCase(F15_TestCase):
+ def runTest(self):
+ F15_TestCase.runTest(self)
+
+ self.assert_parse("raid / --device=md0 --level=1 --encrypted --cipher=3-rot13 raid.01 raid.02",
+ "raid / --device=0 --level=RAID1 --encrypted --cipher=\"3-rot13\" raid.01 raid.02\n")
+ # Allowed here, but anaconda should complain. Note how we throw out
+ # cipher from the output if there's no --encrypted.
+ self.assert_parse("raid / --device=md0 --level=1 --cipher=3-rot13 raid.01 raid.02",
+ "raid / --device=0 --level=RAID1 raid.01 raid.02\n")
+
+ self.assert_parse_error("raid / --cipher --device=md0 --level=1 raid.01 raid.02")
+
if __name__ == "__main__":
unittest.main()
--
1.7.11.4
11 years, 7 months
[pykickstart][PATCH][rhel6] Add cipher option for encrypted autopart.
by David Lehman
Related: rhbz#843174
---
pykickstart/commands/autopart.py | 26 +++++++++++++++++++++++++-
pykickstart/handlers/control.py | 2 +-
tests/commands/autopart.py | 13 +++++++++++++
3 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/pykickstart/commands/autopart.py b/pykickstart/commands/autopart.py
index cf28b5c..2885ad4 100644
--- a/pykickstart/commands/autopart.py
+++ b/pykickstart/commands/autopart.py
@@ -1,7 +1,7 @@
#
# Chris Lumens <clumens(a)redhat.com>
#
-# Copyright 2005, 2006, 2007, 2008 Red Hat, Inc.
+# Copyright 2005, 2006, 2007, 2008, 2012 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
@@ -117,3 +117,27 @@ class F12_AutoPart(F9_AutoPart):
op.add_option("--escrowcert")
op.add_option("--backuppassphrase", action="store_true", default=False)
return op
+
+class RHEL6_AutoPart(F12_AutoPart):
+ removedKeywords = F12_AutoPart.removedKeywords
+ removedAttrs = F12_AutoPart.removedAttrs
+
+ def __init__(self, writePriority=100, *args, **kwargs):
+ F12_AutoPart.__init__(self, writePriority=writePriority, *args, **kwargs)
+ self.cipher = kwargs.get("cipher", "")
+
+ def __str__(self):
+ retval = F12_AutoPart.__str__(self)
+
+ if self.encrypted and self.cipher:
+ # remove any trailing newline
+ retval = retval.strip()
+ retval += " --cipher=\"%s\"" % self.cipher
+ retval += "\n"
+
+ return retval
+
+ def _getParser(self):
+ op = F12_AutoPart._getParser(self)
+ op.add_option("--cipher")
+ return op
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index cf24586..aa1ad39 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -813,7 +813,7 @@ commandMap = {
RHEL6: {
"auth": authconfig.FC3_Authconfig,
"authconfig": authconfig.FC3_Authconfig,
- "autopart": autopart.F12_AutoPart,
+ "autopart": autopart.RHEL6_AutoPart,
"autostep": autostep.FC3_AutoStep,
"bootloader": bootloader.RHEL6_Bootloader,
"cdrom": method.RHEL6_Method,
diff --git a/tests/commands/autopart.py b/tests/commands/autopart.py
index 98b5e8a..6285fec 100644
--- a/tests/commands/autopart.py
+++ b/tests/commands/autopart.py
@@ -75,5 +75,18 @@ class F12_TestCase(F9_TestCase):
self.assert_parse_error("autopart --backuppassphrase=False")
self.assert_parse_error("autopart --backuppassphrase=True")
+class RHEL6_TestCase(F12_TestCase):
+ def runTest(self):
+ F12_TestCase.runTest(self)
+
+ # pass
+ self.assert_parse("autopart --cipher=foo", "autopart\n")
+ self.assert_parse("autopart --encrypted --cipher=3-rot13",
+ "autopart --encrypted --cipher=\"3-rot13\"\n")
+
+ # fail
+ self.assert_parse_error("autopart --cipher")
+ self.assert_parse_error("autopart --encrypted --cipher")
+
if __name__ == "__main__":
unittest.main()
--
1.7.11.4
11 years, 7 months
Fix nfsiso as a stage2 location (#853508)
by Jesse Keating
This should work, and I can run the commands manually from rd.break and it
appears to do the right thing, but I'm having a heck of a time testing it
directly from the files.
--jlk
11 years, 7 months