[PATCH] Deprecate the 'cmdline' command
Jesse Keating
jkeating at redhat.com
Fri Aug 10 23:31:52 UTC 2012
For now make it set text mode instead of erroring.
---
pykickstart/commands/displaymode.py | 33 +++++++++++++++++++++++++++++++++
pykickstart/handlers/control.py | 12 ++++++------
2 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/pykickstart/commands/displaymode.py b/pykickstart/commands/displaymode.py
index 6a12d58..fc8fb12 100644
--- a/pykickstart/commands/displaymode.py
+++ b/pykickstart/commands/displaymode.py
@@ -66,3 +66,36 @@ class FC3_DisplayMode(KickstartCommand):
self.displayMode = DISPLAY_MODE_TEXT
return self
+
+class F18_DisplayMode(FC3_DisplayMode):
+ removedKeywords = FC3_DisplayMode.removedKeywords
+ removedAttrs = FC3_DisplayMode.removedAttrs
+
+ def __str__(self):
+ retval = KickstartCommand.__str__(self)
+
+ if self.displayMode is None:
+ return retval
+
+ if self.displayMode in [DISPLAY_MODE_CMDLINE, DISPLAY_MODE_TEXT]:
+ retval += "# Use text mode install\ntext\n"
+ elif self.displayMode == DISPLAY_MODE_GRAPHICAL:
+ retval += "# Use graphical install\ngraphical\n"
+
+ return retval
+
+ def parse(self, args):
+ (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno)
+
+ if len(extra) > 0:
+ raise KickstartParseError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s does not take any arguments") % self.currentCmd)
+
+ if self.currentCmd == "cmdline":
+ warnings.warn(_("Deprecated option on line %s: The cmdline is deprecated, text mode will be used. In future releases, this will result in a fatal error from kickstart. Please modify your kickstart file to remove any options.") % self.lineno, DeprecationWarning)
+ self.displayMode = DISPLAY_MODE_TEXT
+ elif self.currentCmd == "graphical":
+ self.displayMode = DISPLAY_MODE_GRAPHICAL
+ elif self.currentCmd == "text":
+ self.displayMode = DISPLAY_MODE_TEXT
+
+ return self
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index 6ffaff0..e9c40ac 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -894,7 +894,7 @@ commandMap = {
"btrfs": btrfs.F17_BTRFS,
"cdrom": method.F14_Method,
"clearpart": clearpart.F17_ClearPart,
- "cmdline": displaymode.FC3_DisplayMode,
+ "cmdline": displaymode.F18_DisplayMode,
"device": device.F8_Device,
"deviceprobe": deviceprobe.FC3_DeviceProbe,
"dmraid": dmraid.FC6_DmRaid,
@@ -902,7 +902,7 @@ commandMap = {
"fcoe": fcoe.F13_Fcoe,
"firewall": firewall.F14_Firewall,
"firstboot": firstboot.FC3_Firstboot,
- "graphical": displaymode.FC3_DisplayMode,
+ "graphical": displaymode.F18_DisplayMode,
"group": group.F12_Group,
"halt": reboot.F18_Reboot,
"harddrive": method.F14_Method,
@@ -931,7 +931,7 @@ commandMap = {
"shutdown": reboot.F18_Reboot,
"skipx": skipx.FC3_SkipX,
"sshpw": sshpw.F13_SshPw,
- "text": displaymode.FC3_DisplayMode,
+ "text": displaymode.F18_DisplayMode,
"timezone": timezone.F18_Timezone,
"updates": updates.F7_Updates,
"upgrade": upgrade.F11_Upgrade,
@@ -1173,7 +1173,7 @@ commandMap = {
"bootloader": bootloader.F17_Bootloader,
"cdrom": method.F14_Method,
"clearpart": clearpart.FC3_ClearPart,
- "cmdline": displaymode.FC3_DisplayMode,
+ "cmdline": displaymode.F18_DisplayMode,
"device": device.F8_Device,
"deviceprobe": deviceprobe.FC3_DeviceProbe,
"dmraid": dmraid.FC6_DmRaid,
@@ -1181,7 +1181,7 @@ commandMap = {
"fcoe": fcoe.F13_Fcoe,
"firewall": firewall.F14_Firewall,
"firstboot": firstboot.FC3_Firstboot,
- "graphical": displaymode.FC3_DisplayMode,
+ "graphical": displaymode.F18_DisplayMode,
"group": group.F12_Group,
"halt": reboot.FC6_Reboot,
"harddrive": method.F14_Method,
@@ -1210,7 +1210,7 @@ commandMap = {
"shutdown": reboot.FC6_Reboot,
"skipx": skipx.FC3_SkipX,
"sshpw": sshpw.F13_SshPw,
- "text": displaymode.FC3_DisplayMode,
+ "text": displaymode.F18_DisplayMode,
"timezone": timezone.FC6_Timezone,
"updates": updates.F7_Updates,
"upgrade": upgrade.F11_Upgrade,
--
1.7.11.2
More information about the anaconda-patches
mailing list