[pykickstart 2/3] add correct halt command handling
Brian C. Lane
bcl at redhat.com
Wed Jul 25 16:59:46 UTC 2012
From: "Brian C. Lane" <bcl at redhat.com>
Previously the 'halt' command resulted in KS_SHUTDOWN being set
instead of KS_WAIT.
---
pykickstart/commands/reboot.py | 23 +++++++++++++++++++++++
pykickstart/handlers/control.py | 8 ++++----
2 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/pykickstart/commands/reboot.py b/pykickstart/commands/reboot.py
index 391af14..ef246fd 100644
--- a/pykickstart/commands/reboot.py
+++ b/pykickstart/commands/reboot.py
@@ -77,3 +77,26 @@ class FC6_Reboot(FC3_Reboot):
(opts, extra) = self.op.parse_args(args=args, lineno=self.lineno)
self._setToSelf(self.op, opts)
return self
+
+class F18_Reboot(FC6_Reboot):
+ removedKeywords = FC6_Reboot.removedKeywords
+ removedAttrs = FC6_Reboot.removedAttrs
+
+ def __init__(self, writePriority=0, *args, **kwargs):
+ FC6_Reboot.__init__(self, writePriority, *args, **kwargs)
+ self.op = self._getParser()
+
+ def __str__(self):
+ retval = FC6_Reboot.__str__(self).rstrip()
+
+ if self.action == KS_WAIT:
+ retval += "# Halt after installation\nhalt\n"
+
+ return retval
+
+ def parse(self, args):
+ FC6_Reboot.parse(self, args)
+ if self.currentCmd == "halt":
+ self.action = KS_WAIT
+ return self
+
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index bda3a5e..a24c8b7 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -904,7 +904,7 @@ commandMap = {
"firstboot": firstboot.FC3_Firstboot,
"graphical": displaymode.FC3_DisplayMode,
"group": group.F12_Group,
- "halt": reboot.FC6_Reboot,
+ "halt": reboot.F18_Reboot,
"harddrive": method.F14_Method,
"ignoredisk": ignoredisk.F14_IgnoreDisk,
"install": upgrade.F11_Upgrade,
@@ -920,15 +920,15 @@ commandMap = {
"nfs": method.F14_Method,
"part": partition.F18_Partition,
"partition": partition.F18_Partition,
- "poweroff": reboot.FC6_Reboot,
+ "poweroff": reboot.F18_Reboot,
"raid": raid.F15_Raid,
- "reboot": reboot.FC6_Reboot,
+ "reboot": reboot.F18_Reboot,
"repo": repo.F15_Repo,
"rescue": rescue.F10_Rescue,
"rootpw": rootpw.F8_RootPw,
"selinux": selinux.FC3_SELinux,
"services": services.FC6_Services,
- "shutdown": reboot.FC6_Reboot,
+ "shutdown": reboot.F18_Reboot,
"skipx": skipx.FC3_SkipX,
"sshpw": sshpw.F13_SshPw,
"text": displaymode.FC3_DisplayMode,
--
1.7.7.6
More information about the anaconda-patches
mailing list